-
-
Notifications
You must be signed in to change notification settings - Fork 66
multiple source/dest concats? #52
Comments
I suppose you have read docs for Grunt and this plugin, add this code to your Gruntfile and it didn’t work as you expected (of course after reading the docs). But you were so exhausted that you forgot to describe what was wrong. Please do that now. |
I was expecting something along with way concat works with tasks like 'dev' and 'dist' and within them files: [ { src: {}, dest: {} }, { src: {}, dest: {} }, /* etc */ ] It seems I have to make each set of files a diff task, so while this ran without error:
It did not pull in dependencies from bower, ex: b_js created b.js with bower-test-b but without it's dependency bower-test-a. All of bower-test-* have a bower.json with mainfile (which grunt -v shows as being found) and dependencies set (which work since bower pulls in dependencies). So does using an 'include' exclude dependencies? Or what am I doing wrong? |
Yep, |
Hmmm. What I want is to not load all my JS on every page, so to be able to create separate bundles per (type of) page, but still not have to worry about dependencies and concat order (because that's already defined in Bower). |
They will be in the right order, no matter in which order you specify them in the I’m not sure how to make it better. |
Yeah, I don't want to have to specify dependencies - that's what I was doing before manually with regular concat. Perhaps an option that turns on dependency loading even when using include, with a warning if you're not using it correctly you could load some packages twice? |
Yeah, that would work. It would be great if you could create a pull request with that feature. |
I'm not up on creating Grunt plugins, but I know JS. It looks like the section in question that short circuits the dependency checking/loading is this in function bowerMainFiles() :
I'm thinking a "forceDependencies" option that overrides the above if statements with a (!options.forceDependencies) conditional. If I'm on right track it seems like it shouldn't be too difficult for me to add this functionality in a PR. |
I think I'm having the same problem. Given the example given here, it looks like we should be able to do it, but grunt tells me That said, there's a possibility that my syntax is wrong somewhere... but I triple checked it, and even rebuilt it from scratch using the example. |
@Shino-, until you show me your gruntfile I could’t tell you what’s wrong with it. |
@toddzebert, I think it would be easier to add all the dependencies of “included” components to the And I don’t like the name |
@sapegin ok, here's the current version of the task with only one element. 'use strict';
module.exports = function bower_concat(grunt) {
// Load task
grunt.loadNpmTasks('grunt-bower-concat');
// Options
return {
bower_concat: {
components: {
dest: 'public/js/components.js',
dependencies: {
'jquery-ui': 'jquery',
'jquery-cookie': 'jquery',
'jquery-validation': 'jquery',
'dustjs-linkedinhelpers': 'dustjs-linkedin'
},
exclude: [
'doc-ready',
'eventEmitter',
'eventie',
'fizzy-ui-utils',
'get-size',
'get-style-property',
'jquery-hashchange',
'jquery-mobile-bower',
'jquery-mobile',
'jquery-ui-tabs',
'matches-selector',
'outlayer'
],
mainFiles: {
'jquery': 'dist/jquery.min.js',
'modernizr': 'modernizr.js',
'jquery-ui': ['ui/effect.js','ui/effect-puff.js','ui/effect-scale.js','ui/effect-size.js'],
'imagesloaded': 'imagesloaded.pkgd.min.js',
'masonry': 'dist/masonry.pkgd.min.js',
'jquery-cookie': 'jquery.cookie.js',
'dustjs-linkedin': 'dist/dust-core.min.js',
'dustjs-linkedin-helpers': 'dist/dust-helpers.min.js',
'jquery-validation': 'dist/jquery.validate.min.js'
}
}
}
};
}; The gruntfile has |
@Shino- While I think you have a different issue than I, I don't see any problem with your bower_concat syntax. Although, I'm not familiar with your use of |
Something like:
The text was updated successfully, but these errors were encountered: