javascript - Grunt-injector - Inject parent directories first -
i'm using grunt-injector
, have list of files being injected using 'app/**/*.js
don't want inject files alphabetically causing dependency errors. want systematically inject files in parent directory, move next level , inject files , on. way inject parent files first , remove dependency issues.
can this? i've tried looking @ grunt-include-source
includes top-down
file sort want unable working , i'd rather stick injector used heavily @ moment.
i had same problem, had changes in injector.js script (node_modules/grunt-injector/tasks/injector.js).
you have do:
1.- looking comment "sort files if needed" , add else case:
else { //parent dir's files go first. if (options.parentdirfirst) { sources.sort(function (a, b) { return a.file.split("/").length - b.file.split("/").length; }); } }
2.- in gruntfile.js have set option parentdirfirst true:
injector: { options: { parentdirfirst: true, . . . }, . . . }
these changes sent joakim bengtson. needs contributors maintain plugin, he's looking people want out , contributors, don't have enough time.
Comments
Post a Comment