Sails Js view engine with layout sections support?

James

Does anyone know of a view engine for sails js that has support for optional/required sections in a layout?

Example my layout has:

<html>
<head>
...
css files
...
</head>
<body>
...
<%- body %>
...
js files
...
</html>

So all my view content would end up going where the <%- body %> tag is. But I need page-specific javascript on the page and that javascript relies on the js files included below where the view is injected. Normally in other MVC frameworks they allow you to define other sections in the layout to remedy this, but I haven't been able to find much information on this for sails js.

Sure, I could just put my js includes on the layout into the head tag, but that's a pretty big cop out to get around not having layout sections.

James

Dust has what I am looking for: http://akdubya.github.io/dustjs/

File: base.dust
<html>
    <head>
    ...
    css files
    ...
</head>
<body>
    ...
    {+body/}
    ...
    js files
    {+javascript/}
    ...
</html>


File: homepage.dust
{>base/}
{<body}
    my home page content body
{/body}
{<javascript}
    my page specific javascript.
{/javascript}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Sails Js view engine with layout sections support?

From Dev

sails js layout view change folder

From Dev

sails.js - layout could knows the controller/view called?

From Dev

For loops and layout support in express.js template engine

From Dev

Different Layout in different Table view sections

From Dev

New to Sails.js how can I route to a view without including the layout.ejs?

From Dev

Sails.js: load script on a specific view

From Dev

Custom view/action/controller not working in Sails JS

From Dev

Including view specific assets in Sails.js

From Dev

Sails.js - passing data to a view

From Dev

Sails.js: load script on a specific view

From Dev

Swig template engine and Sails.js - how to change tagControls

From Dev

How to setup Sails.js routes to support pushstate with a SPA on the frontend

From Dev

Not able to add scripts in layout.ejs (sails.js)

From Dev

cron support in node.js App Engine

From Dev

Specifying a layout file in Sails.js when calling sails.renderView

From Dev

MVC Layout Sections

From Dev

Setting Sails js view extension doesn't work

From Dev

Load a javascript/coffeescript file only for one view in Sails.js

From Dev

Handling session variables in view file in sails.js

From Dev

How to configure Sails.js to use EJS view helpers?

From Dev

sails.js get environment value from config in view

From Dev

Sails.js send data from partial controller to partial view

From Dev

sails.js data from api loop through in view

From Dev

Sails.js and Mocha, res.view testing

From Dev

how to access assets/images from the view in Sails.js?

From Dev

How to configure Sails.js to use EJS view helpers?

From Dev

Load a javascript/coffeescript file only for one view in Sails.js

From Dev

Sails.js and Mocha, res.view testing

Related Related

  1. 1

    Sails Js view engine with layout sections support?

  2. 2

    sails js layout view change folder

  3. 3

    sails.js - layout could knows the controller/view called?

  4. 4

    For loops and layout support in express.js template engine

  5. 5

    Different Layout in different Table view sections

  6. 6

    New to Sails.js how can I route to a view without including the layout.ejs?

  7. 7

    Sails.js: load script on a specific view

  8. 8

    Custom view/action/controller not working in Sails JS

  9. 9

    Including view specific assets in Sails.js

  10. 10

    Sails.js - passing data to a view

  11. 11

    Sails.js: load script on a specific view

  12. 12

    Swig template engine and Sails.js - how to change tagControls

  13. 13

    How to setup Sails.js routes to support pushstate with a SPA on the frontend

  14. 14

    Not able to add scripts in layout.ejs (sails.js)

  15. 15

    cron support in node.js App Engine

  16. 16

    Specifying a layout file in Sails.js when calling sails.renderView

  17. 17

    MVC Layout Sections

  18. 18

    Setting Sails js view extension doesn't work

  19. 19

    Load a javascript/coffeescript file only for one view in Sails.js

  20. 20

    Handling session variables in view file in sails.js

  21. 21

    How to configure Sails.js to use EJS view helpers?

  22. 22

    sails.js get environment value from config in view

  23. 23

    Sails.js send data from partial controller to partial view

  24. 24

    sails.js data from api loop through in view

  25. 25

    Sails.js and Mocha, res.view testing

  26. 26

    how to access assets/images from the view in Sails.js?

  27. 27

    How to configure Sails.js to use EJS view helpers?

  28. 28

    Load a javascript/coffeescript file only for one view in Sails.js

  29. 29

    Sails.js and Mocha, res.view testing

HotTag

Archive