Reputation: 51
How to add to blocks from the configuration file?
Eg: Set a list of scripts/styles to include in the block by doing something like:
@getBlock('scripts').add([
'/vendor/jquery.js'
'/vendor/jquery-ui.js'
])
In the configuration file.
Upvotes: 2
Views: 453
Reputation: 51
As per Issue #387 on GitHub, answered by balupton:
There are two ways we generally can do this.
templateData:
site:
scripts: [
'/vendor/jquery.js'
'/vendor/jquery-ui.js'
]
Then inside your layout:
<%- @getBlock('scripts').add(@site.scripts).toHTML()
events:
populateCollections: ->
@getBlock('scripts').add([
'/vendor/jquery.js'
'/vendor/jquery-ui.js'
])
Upvotes: 3