I may be completely misunderstanding how to use connect-assetmanager for my node project. But I have set up which js files I want to package up into a 'group' - but how do I refer to this group in my ejs/jade template?
Surely I need to somehow 'render' this package in my template?
I found the solution:
In your server for example, you could set up a dynamic helper like so:
app.dynamicHelpers({
'assetsCacheHashes': function(req, res) {
return assetsManagerMiddleware.cacheHashes;
}
});
where assetsManagerMiddleware represents your assetManager.
Then in your ejs template, you can render the generated asset package like so:
<script src="/js/<%= assetsCacheHashes.js || 0 %>.js"></script>
In your view source - see which path it is choosing and adjust your path accordingly.
For Jade: script(type='text/javascript', src='/the/groups/route')
Your asset groups should have a route specified. That regex is used to determine if a request is asking for the that group. If it matches, it should serve the group.