Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "name": "my-project-name",
- "version": "0.1.0",
- "devDependencies": {
- "grunt": "~0.4.5",
- "grunt-contrib-cssmin": "^0.10.0",
- "grunt-contrib-jshint": "~0.10.0",
- "grunt-contrib-uglify": "~0.5.0",
- "grunt-contrib-watch": "^0.6.1",
- "matchdep": "^0.3.0"
- }
- }
- module.exports = function(grunt){
- //Loads the necessary tasks for this Grunt file.
- require('matchdep').filterDev('grunt-contrib-*').forEach(grunt.loadNpmTasks);
- // Project configuration
- grunt.initConfig({
- // Load package.json file so that access is given to the project name and version number.
- pkg: grunt.file.readJSON('package.json'),
- // Constants for the Gruntfile so we can easily change the path for our environments.
- //note: end with /
- BASE_PATH: '../',
- JS_SOURCE_PATH: '../js/src/',
- JS_BUILD_PATH: '../js/build/',
- CSS_SOURCE_PATH: '../css/src/',
- CSS_BUILD_PATH: '../css/build/',
- uglify: {
- files: {
- expand: true,
- cwd: '<%= JS_SOURCE_PATH %>',
- src: '**/*.js',
- dest: '<%= JS_BUILD_PATH %>',
- flatten: false,
- }
- },
- jshint: {
- options: {
- jshintrc: '<%= JS_SOURCE_PATH %>.jshintrc',
- force: true
- },
- all: [
- '<%= JS_SOURCE_PATH %>**/*.js',
- '!<%= JS_SOURCE_PATH %>third-party/**/*.js'
- ]
- },
- cssmin: {
- options: {
- keepBreaks: true,
- report: 'gzip'
- },
- minify: {
- expand: true,
- cwd: '<%= CSS_SOURCE_PATH %>',
- src: '**/*.css',
- dest: '<%= CSS_BUILD_PATH %>'
- }
- },
- watch: {
- options: {
- livereload: true,
- nospawn: true
- },
- js: {
- files: ['<%= JS_SOURCE_PATH %>**/*.js'],
- tasks: ['jshint']
- },
- css: {
- files: ['<%= CSS_SOURCE_PATH %>**/*.css'],
- tasks: ['cssmin']
- },
- html: {
- files: ['<%= BASE_PATH %>*.html']
- }
- }
- });
- grunt.registerTask('default', ['jshint', 'uglify', 'cssmin']);
- grunt.registerTask('doit', ['uglify', 'cssmin']);
- grunt.registerTask('css', ['cssmin']);
- grunt.registerTask('hint', ['jshint']);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement