Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
feat(grunt): add ngmin build all subcomponents in dist/sub
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Dec 29, 2013
1 parent 08121f8 commit 783140a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
30 changes: 28 additions & 2 deletions gruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ module.exports = function (grunt) {
grunt.registerTask('publish', fakeTargetTask('publish'));
//


//
var moduleNames = grunt.file.expand({ cwd: 'modules' }, ['*','!utils.js']);
function ngMinModulesConfig(memo, moduleName){

memo[moduleName]= {
expand: true,
cwd: 'modules/' + moduleName,
src: [moduleName + '.js'],
dest: 'dist/sub/' + moduleName
};

return memo;
}
//


var testConfig = function(configFile, customOptions) {
var options = { configFile: configFile, singleRun: true };
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox', 'PhantomJS'], reporters: ['dots'] };
Expand Down Expand Up @@ -83,11 +100,18 @@ module.exports = function (grunt) {
},
uglify: {
options: {banner: '<%= meta.banner %>'},
build: {
main: {
files: {
'dist/main/ui-utils.min.js': ['dist/main/ui-utils.js'],
'dist/main/ui-utils-ieshiv.min.js': ['dist/main/ui-utils-ieshiv.js']
}
},
sub: {
expand: true,
cwd: 'dist/sub/',
src: ['**/*.js'],
ext: '.min.js',
dest: 'dist/sub/'
}
},
clean: {
Expand Down Expand Up @@ -115,7 +139,9 @@ module.exports = function (grunt) {
{src: ['modules/include/demo/fragments.html'], dest: 'demo/fragments.html', filter: 'isFile'}
]
}
}
},

ngmin: moduleNames.reduce(ngMinModulesConfig, {})
};
grunt.initConfig(initConfig);

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"grunt-contrib-uglify": "~0.2.1",
"grunt-contrib-watch": "~0.4.3",
"grunt-karma": "~0.6.2",
"load-grunt-tasks": "~0.2.0"
"load-grunt-tasks": "~0.2.0",
"grunt-ngmin": "0.0.3"
},
"scripts": {},
"repository": {
Expand Down

0 comments on commit 783140a

Please sign in to comment.