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 targets for bundled scripts and styles? #76

Closed
alexweissman opened this issue Mar 17, 2016 · 8 comments
Closed

Custom targets for bundled scripts and styles? #76

alexweissman opened this issue Mar 17, 2016 · 8 comments

Comments

@alexweissman
Copy link

Thanks for the great plugin! This seems like the exact solution I need for a full-fledged asset manager.

This issue relates to #22 and #60. In addition to specifying custom bundle directories in the bundle.result.json, it would also be useful if I could specify custom target directories for different types of assets. For example, multiple bundles' Javascript assets could be written to public/js/, while CSS assets could all be written to public/css/.

Is this currently possible?

@Waymoot
Copy link

Waymoot commented Mar 17, 2016

I second this suggestion.
I had to run two different bundle configs separating CSS and JS just to make this happen.

@chmontgomery
Copy link
Contributor

actually this is possible, however poorly documented. You can accomplish this by adding the paths as part of the bundle name in bundle.config.js as seen here: https://github.com/dowjones/gulp-bundle-assets/blob/master/examples/custom-url-paths/bundle.config.js

For your use case, it would basically look like this:

// bundle.config.js
module.exports = {
  bundle: {
    'js/main': {
      scripts: './*.js'
    },
    'css/main': {
      styles: './*.css'
    }
  }
};
// gulpfile.js
gulp.task('bundle', function () {
  return gulp.src('./bundle.config.js')
    .pipe(bundle())
    .pipe(gulp.dest('./public'));
});

So the resulting files would be public/js/main.js and public/css/main.css

Please let me know if that answers your question

@Waymoot
Copy link

Waymoot commented Mar 17, 2016

Wow that looks to solve the issue 👍
I have to check it out and yes, this really should be documented better because that was a great feature.
Thanks for that!

@alexweissman
Copy link
Author

Awesome, thanks for the quick reply! I'll try this out.

@alexweissman
Copy link
Author

It looks like my question is actually a duplicate of #49. Should we add it to the Wiki?

@chmontgomery
Copy link
Contributor

@alexweissman definitely. want to take a crack at writing up some markdown for documenting this?

@alexweissman
Copy link
Author

Done.

@chmontgomery
Copy link
Contributor

@alexweissman perfect! thanks!

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