manifest.json using this pattern:
But say I wanted to require a file called
scripts/filters.js only on the About page. What is the best way to require certain modules in this way using Sage conventions?
You could do something like this:
Couple things to note: the source dir of the new file is the theme root and not
assets/ like the existing manifest, so you’ll need to account for that in your source paths. Also, libraries you install via Bower must be included manually (otherwise they won’t be built into your
Helpful debugging tip: Sage: Wiredep & SASS Framework
Ok great, so now my globs look like this:
But I am not getting the code from my about.js script loading in my minified main.js.
I am assuming I wouldn’t enque this script separately? And once I do that, how do I map that about.js file to the body class=“about” page ?
You would enqueue
about.js separately and conditionally, it will not be included in
If you want the script itself to fire only on certain pages then please be sure to read the comments on DOM based routing and use
main.js as a template for your new file.