Open cibulka opened 9 years ago
OK, I have absolute path to plugin-1
etc. stored in another config variable, so for now, I prepend it manually to each dep.globs
like this:
manifest.forEachDependency('css', function(dep) {
for (var i=0; i < dep.globs.length; i++) {
dep.globs[i] = config.base + dep.globs[i];
}
gulp.src(dep.globs).pipe() ...
}
Still wondering if there is a better way though ...
Weirdly enough, I've just noticed, that the absolute path to my plugin-1
get prepended by Asset Builder for my Bower files, but not my main files.
console.log(dep.name)
// outputs
[
/abs-path/to/plugin-1//abs-path/to/plugin-1/bower_components/object-fit/dist/polyfill.object-fit.css,
/abs-path/to-plugin-1/assets/my-style.scss
]
So I ended up with:
for (var i=0; i < dep.globs.length; i++) {
if (dep.globs[i].substring(0, config.base.length) != config.base) {
dep.globs[i] = config.base + dep.globs[i];
}
}
Weirdly enough, I've just noticed, that the absolute path to my plugin-1 get prepended by Asset Builder for my Bower files, but not my main files.
So this behavior comes from https://github.com/ck86/main-bower-files. I definitely want to expose the option to either make all of the globs absolute or all of the globs relative.
You are bringing up an interesting point and I definitely want to support your usecase. Perhaps I should add a "cwd" option to the main entry function and the "make relative"/"make absolute" respect it? The default CWD could be whatever directory your gulpfile lives in.
Sounds cool! I will stay tuned - however my current "fix" works, so no pressure. :)
Hello!
I use Asset-builder with gulp-hub plugin, that allows to run tasks from multiple Gulpfiles specified at project's root.
This is a simplified version of my setup:
This way, I can run ...
... to avoid manually CDing to each plugin folder and all the relevant files are watched by Gulp as they supposed to.
This setup works with asset manifest only if I hardcode absolute paths to
manifest.json
.I tried to make it work by specifying
cwd
option to my (e.g.) sass task like this ...... but it doesn't seem to have any effect. Do I do something wrong or is there some another recommended setup for such case?
Thank you very much in advance!