Improve build scripts of Web frontend

This commit is contained in:
Francis Lachapelle
2014-08-06 15:43:03 -04:00
parent e817a3b3d0
commit d52d7582ca
4 changed files with 50 additions and 14 deletions

View File

@@ -4,7 +4,8 @@ module.exports = function(grunt) {
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
includePaths: ['bower_components/foundation/scss',
'bower_components/ionic/scss']
},
dist: {
options: {
@@ -14,7 +15,8 @@ module.exports = function(grunt) {
files: {
'css/app.css': 'scss/app.scss',
'css/SOGoRootPage.css': 'scss/SOGoRootPage.scss',
'css/ContactsUI.css': 'scss/ContactsUI.scss'
'css/ContactsUI.css': 'scss/ContactsUI.scss',
'css/mobile.css': 'scss/mobile.scss'
}
}
},
@@ -34,4 +36,27 @@ module.exports = function(grunt) {
grunt.registerTask('build', ['sass']);
grunt.registerTask('default', ['build','watch']);
grunt.registerTask('js', function(dev) {
var options = {
'src': 'bower_components',
'dest': 'js/vendor/',
'min': (dev? '' : '.min')
};
var vendor = [
'<%= src %>/angular/angular<%= min %>.js',
'<%= src %>/angular-sanitize/angular-sanitize<%= min %>.js',
'<%= src %>/angular-ui-router/release/angular-ui-router<%= min %>.js',
'<%= src %>/angular-foundation/mm-foundation-tpls<%= min %>.js',
'<%= src %>/foundation/js/foundation<%= min %>.js',
'<%= src %>/ionic/release/js/ionic<%= min %>.js',
'<%= src %>/underscore/underscore-min.js'
];
for (var i = 0; i < vendor.length; i++) {
var src = grunt.template.process(vendor[i], {data: options});
var paths = src.split('/');
var dest = options.dest + paths[paths.length-1];
grunt.file.copy(src, dest);
grunt.log.ok("copy " + src + " => " + dest);
}
});
}