javascript - grunt-contrib-concat: specify last file to be concatenated? -
i'm using grunt-contrib-concat concatenate custom js files together, , wrap them iife. i'm running load order issues ( namely, init file executing before modules, causing undefined errors ). want specify init.js
should last in concat order, don't want specify order other js files well, specific 1 goes last.
here current config of concat:
/** * set project info */ project: { src: 'src', app: 'app', assets: '<%= project.app %>/assets', css: [ '<%= project.src %>/scss/style.scss' ], js: [ '<%= project.src %>/js/*.js' ] }, concat: { dev: { files: { '<%= project.assets %>/js/scripts.min.js': '<%= project.js %>' } }, options: { stripbanners: true, nonull: true, banner: ';(function($, window, document, undefined){ \n "use strict";', footer: '}(jquery, window, document));' } },
how specify last file concatenated without adding grunt module project?
you can concatenating files but init.js
, , concatenating result init.js
, using array syntax maintains order:
concat: { dev1: { dest: '<tmp>/concat1.js', src: ['<all js>', '!init.js'] }, devfinal: { options: { stripbanners: true, nonull: true, banner: ';(function($, window, document, undefined){ \n "use strict";', footer: '}(jquery, window, document));' }, files: { dest: 'scripts.min.js', src: ['<tmp>/concat1.js', 'init.js'] }, }, }
and call both targets in succession:
grunt.registertask('myconcat', ['concat:dev1', 'concat:devfinal']);
Comments
Post a Comment