I’m completely new to Sage, but I’m very interested in figuring this all out so I can get going. I like the idea of bower/gupl/etc. but often find myself wondering if it’s really worth all the added complexity.
Anyway! As I’m looking through this, it looks like if I added a bower package via
So here’s my question: Is it possible, and if so how, to enqueue only specific packages conditionally?
Happily, I can answer my own question.
The trick of the whole thing lies in the magic of the manifest.json file. The reason that all bower files are loaded without any effort is that the line in the manifest file,
"main": true tells the gulp automation to load all unclaimed bower assets into that file. In this case they’re put in main.js, and this file is enqueued on line 76 of of assets.php.
But! If, in the manifest.json file, you specify where a bower packages assets are to go (such as the jquery lines), then instead the assets are loaded into the specified file name. This new file is not automatically enqueued. That being the case, you have full control over when to load it. Bam.
I like this the more I tinker with it!
Yes, much to @austin and the magical asset-builder. I love how flexible the whole workflow is.