gulp-bundle-assets
gulp-bundle-assets copied to clipboard
Searching multiple base paths for assets
I want to be able to search multiple base paths for assets referenced in my bundle.config.json
file. For example, I have assets split up between app/core/assets/
and a set of subdirectories defined as app/sprinkles/*/assets/
. I tried setting my base
option as:
base: '../app/{core/assets/,sprinkles/*/assets/}';
This is the syntax specified in the npm glob module.
gulp-bundle-assets
seems to recognize the curly-brace syntax, but it doesn't seem to construct the paths to my assets correctly. For example, I have this in my bundle.config.json
:
{
"bundle": {
"js/main": {
"scripts": [
"vendor/bootstrap-3.3.6/js/bootstrap.js",
"vendor/jQueryValidation-1.14.0/jquery.validate.js",
"vendor/jQueryValidation-1.14.0/additional-methods.js"
]
When I run my build task, I get output like this:
Bundle 'js/main.scripts' using ../../../../../../core/assets/vendor/bootstrap-3.3.6/js/bootstrap.js
So, for some reason it is losing the app/
, and instead trying to move way back up the directory tree.
ping!
sorry @alexweissman I just changed jobs so I've had little time to manage gba. Unfortunately this usage isn't something I've personally ever tried or heard of anyone trying.
The base prefixed to the script paths using path.join
and then passed to gulp here: https://github.com/dowjones/gulp-bundle-assets/blob/master/lib/stream-files.js#L48
gulp, I think, using this module internally to understand the path: https://github.com/contra/glob2base
I likely won't have time to look more into this but if you fix it via a PR I will merge it!
Thanks for getting back to me - and I completely understand.
I don't really have much experience with Node and Gulp, so we might have to wait until someone who does comes along!
scripts: [
bf.buildJSPath("user/register/controllers/proSignupJobsController.js"),
bf.buildJSPath("shared/directives/tpCarousel.js"),
],
We use functions to build different paths based on custom logic, works perfectly with environment variables or any other stuff.