Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching multiple base paths for assets #91

Open
alexweissman opened this issue Jun 25, 2016 · 4 comments
Open

Searching multiple base paths for assets #91

alexweissman opened this issue Jun 25, 2016 · 4 comments
Labels

Comments

@alexweissman
Copy link

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.

@alexweissman
Copy link
Author

ping!

@chmontgomery
Copy link
Contributor

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!

@alexweissman
Copy link
Author

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!

@Eduardo-Julio
Copy link

Eduardo-Julio commented May 7, 2020

            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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants