(js) New file structure for Angular modules

JavaScript files are now merged by the 'js' Grunt task.
This commit is contained in:
Francis Lachapelle
2015-06-12 12:01:21 -04:00
parent b1ff1d4365
commit 1dc5f0d412
65 changed files with 2995 additions and 2397 deletions
+31 -3
View File
@@ -1,10 +1,16 @@
module.exports = function(grunt) {
var js_files = {
'js/Common.js': ['js/Common/Common.app.js', 'js/Common/*.filter.js', 'js/Common/*Controller.js', 'js/Common/*.service.js', 'js/Common/*.directive.js'],
'js/Scheduler.js': ['js/Scheduler/*.js'],
'js/Contacts.js': ['js/Contacts/*.js'],
'js/Mailer.js': ['js/Mailer/*.js'],
'js/Preferences.js': ['js/Preferences/*service.js', 'js/Preferences/*Controller.js']
};
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
sourceMap: true,
// require: 'SassyJSON',
noCache: true,
includePaths: ['scss/',
'bower_components/breakpoint-sass/stylesheets/'
@@ -42,6 +48,20 @@ module.exports = function(grunt) {
src: 'css/styles.css'
}
},
concat_sourcemap: {
dist: {
options: {
sourcesContent: false
},
files: js_files
},
dev: {
options: {
sourcesContent: true
},
files: js_files
}
},
watch: {
grunt: {
files: ['Gruntfile.js']
@@ -49,12 +69,17 @@ module.exports = function(grunt) {
sass: {
files: 'scss/**/*.scss',
tasks: ['sass']
},
js: {
files: Object.keys(js_files).map(function(key) { return js_files[key]; }),
tasks: ['js']
}
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-concat-sourcemap');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.task.registerTask('static', function() {
@@ -119,7 +144,10 @@ module.exports = function(grunt) {
}
*/
});
grunt.task.registerTask('build', ['static', 'sass', 'postcss:dist']);
grunt.task.registerTask('build', ['static', 'concat_sourcemap:dist', 'sass', 'postcss:dist']);
// Tasks for developers
grunt.task.registerTask('default', ['watch']);
grunt.task.registerTask('css', ['sass', 'postcss:dev']);
grunt.task.registerTask('default', ['build', 'watch']);
grunt.task.registerTask('js', ['concat_sourcemap:dev']);
grunt.task.registerTask('dev', ['css', 'js']);
};