I have directory structure as below apps
|--GruntFile.js
|--package.json
|--js
|--js.txt
|--global
|--backbone.js
|--jquery.js
|--lodash.js
|--base.js
|--css
|--a.css
|--b.css
|--c.css
And have gruntFile.js as below:
module.exports = function(grunt){
require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jsFiles: grunt.file.read('apps/js.txt'),
concat: {
options: {
separator: ';'
},
dist: {
src: [ '<%= jsFiles %>' ],
dest: 'build/js/main_base.js'
}
},
});
grunt.registerTask('default', ['concat']);
};
My js.txt file contains js files list, which needed to be processed in sequence. js.txt:
'assets/js/global/lodash.js',
'assets/js/global/underscore.js',
'assets/js/global/backbone.js',
'assets/js/base.js
And my package.json is below:
{
"name": "abc",
"version": "1.0.0",
"author": "Allen",
"private": true,
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "^1.0.0",
"grunt-contrib-cssmin": "^1.0.0",
"grunt-contrib-handlebars": "^1.0.0",
"grunt-contrib-less": "^1.2.0",
"grunt-contrib-uglify": "^1.0.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-cssc": "^0.2.6",
"grunt-htmlhint": "^0.9.12-fix",
"matchdep": "^1.0.1"
},
}
Now when i am compiling the files using grunt file, it is getting compile successfully, but the main_base.js in build folder is of size 0. Actually my concept goes like this, whatever the js files i am adding in my repo, i am maintaining it sequentially in js.txt , rather than maintaining them in GruntFile.js in concat task. Similar thing i want to do will all my less files. But it is not getting process. Any idea, where i am missing? Thanks.