Created
August 21, 2016 11:06
-
-
Save chalist/7724618fdc5ec3ab20bd459883cd76ce to your computer and use it in GitHub Desktop.
Grunt example file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
jshint: { | |
files: ['Gruntfile.js', 'generator/static/generator/js/*.js'], | |
options: { | |
globals: { | |
jQuery: true, | |
console: true, | |
module: true | |
} | |
} | |
}, | |
uglify: { | |
options: { | |
compress: true, | |
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */' | |
}, | |
my_target: { | |
files: [{ | |
expand: true, | |
cwd: 'generator/static/generator/js', | |
src: '**/*.js', | |
dest: 'static/dest/js/' | |
}] | |
} | |
}, | |
sass: { | |
dist: { | |
options: { | |
style: 'expanded' | |
}, | |
files: { | |
'generator/static/generator/css/style.css': 'generator/static/generator/scss/style.scss' | |
} | |
} | |
}, | |
cssmin: { | |
target: { | |
files: [{ | |
expand: true, | |
cwd: 'generator/static/generator/css', | |
src: ['*.css', '!*.min.css'], | |
dest: 'static/dest/css', | |
ext: '.min.css' | |
}] | |
} | |
}, | |
browserSync: { | |
dev: { | |
bsFiles: { | |
src: [ | |
'generator/static/generator/css/*.css' | |
] | |
}, | |
options: { | |
watchTask: true, | |
server: './', | |
proxy: "127.0.0.1:3000" | |
} | |
} | |
}, | |
watch: { | |
options: { | |
livereload: true, | |
}, | |
// html: { | |
// files: ['index.html'], | |
// }, | |
js: { | |
files: ['generator/static/generator/js/*.js'], | |
tasks: ['jshint', 'uglify'], | |
}, | |
sass: { | |
options: { | |
livereload: false | |
}, | |
files: ['generator/static/generator/scss/*.scss'], | |
tasks: ['sass'], | |
}, | |
css: { | |
files: ['generator/static/generator/css/*.css'], | |
tasks: ['cssmin'] | |
} | |
} | |
}); | |
// Load the plugin that provides the "uglify" task. | |
grunt.loadNpmTasks('grunt-contrib'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-browser-sync'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
// Default task(s). | |
grunt.registerTask('default', ['watch', 'cssmin', 'sass', 'browserSync']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment