Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module.exports = function (grunt) {
var externalDeps = [
"static/bower_components/angular/angular.min.js",
"static/bower_components/angular-ui-router/release/angular-ui-router.min.js",
"static/bower_components/restangular/dist/restangular.min.js"
];
var catalogJsFiles = [
"static/catalogApp/app.js",
"static/catalogApp/**/*.js",
];
var ngTemplates = [
"static/catalogApp/**/*.html",
];
var styles = [
"static/catalogApp/**/*.css",
];
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
externalDeps: {
src: externalDeps,
dest: 'static/build/externalDeps.js'
},
catalog: {
src: catalogJsFiles,
dest: 'static/build/catalogApp.js'
},
styles: {
src: styles,
dest: 'static/build/catalogApp.css'
}
},
uglify: {
externalDeps: {
options: {
sourceMap: false,
mangle: false,
beautify: {
beautify: false,
ascii_only: true,
quote_keys: true
}
},
files: {
'static/build/externalDeps.min.js': ['static/build/externalDeps.js']
}
},
catalog: {
options: {
sourceMap: false,
mangle: false
},
files: {
'static/build/catalogApp.min.js': ['static/build/catalogApp.js']
}
}
},
ngtemplates: {
app: {
src: ngTemplates,
dest: 'static/build/ng-templates.js',
tasks: ['ngtemplates:catalog.templates', 'concat:catalog'],
options: {
spawn: false,
module: 'catalogApp'
}
}
},
cssmin: {
options: {
shorthandCompacting: false,
roundingPrecision: -1
},
target: {
files: {
'static/build/catalogApp.min.css': ['static/build/catalogApp.css']
}
}
},
watch: {
options: {livereload: true},
externalDeps: {
files: externalDeps,
tasks: ['concat:externalDeps']
},
crmJsFiles: {
files: catalogJsFiles,
tasks: ['concat:catalog']
},
ngTemplates:{
files: ngTemplates,
tasks: ['ngtemplates']
},
styles: {
files: styles,
tasks: ['concat:styles']
}
}
});
// Load plugins here.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-angular-templates');
// Register tasks here.
grunt.registerTask('default', ['concat', 'uglify', 'ngtemplates', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment