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

Custom Bower components directory #1362

Closed
slightlyfaulty opened this issue Mar 2, 2015 · 6 comments
Closed

Custom Bower components directory #1362

slightlyfaulty opened this issue Mar 2, 2015 · 6 comments

Comments

@slightlyfaulty
Copy link

It looks like lib/assets.php is trying to enqueue dist/scripts/modernizr.js although it doesn't exist. It does however seem like it's being included in dist/scripts/main.js, so enqueuing it is redundant anyway.

I've fixed this temporarily by commenting out the line wp_enqueue_script('modernizr', ... in lib/assets.php and modernizr seems to be triggering just fine without it.

@retlehs
Copy link
Member

retlehs commented Mar 2, 2015

@slightlyfaulty
Copy link
Author

I am using version 8.0.1. After some debugging I've discovered that the problem occurs because I've changed Bower's package directory in .bowerrc to assets/vendor -- somehow this is causing Modernizr and jQuery to be bundled with main.js. Changing it back to bower_components and rebuilding fixes it, but why is this happening in the first place?

@austinpray
Copy link
Contributor

@saulfautley mainBowerFiles, which is used by asset-builder as a dependency, behaves a little weird in this situation and doesn't respect your bowerrc changes. I added an option to overcome this.

If you want to change the directory, in your gulpfile use asset-builder as such:

var manifest = require('asset-builder')('./assets/manifest.json', {
  paths: {
   bowerDirectory: 'assets/vendor'
  }
});

@slightlyfaulty
Copy link
Author

@austinpray I've tried that but it doesn't seem to work. Looking through the code of asset-builder it seems that bower_components is hardcoded (lib/buildGlobs.js:112) and has no way of changing via options. I have manually changed this line to reflect my custom Bower directory and it works perfectly, even without specifying the paths.bowerDirectory option.

@austinpray
Copy link
Contributor

@saulfautley oh yeah you are right. I manually check for bower_components to fix some corner case with jquery plugin naming. It definitely needs to be way more clever than that. I'll get around to fixing it but patches definitely welcome!

@retlehs retlehs changed the title dist/scripts/modernizr.js Not Found Custom Bower components directory Mar 4, 2015
@retlehs
Copy link
Member

retlehs commented Mar 13, 2015

closing this here since it's being addressed upstream austinpray/asset-builder#22

@retlehs retlehs closed this as completed Mar 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants