Skip to content

Instantly share code, notes, and snippets.

@andersoonweb
Created April 16, 2016 20:32
Show Gist options
  • Save andersoonweb/1c381d2682d402015827ed2f61beaf41 to your computer and use it in GitHub Desktop.
Save andersoonweb/1c381d2682d402015827ed2f61beaf41 to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
grunt.initConfig({
clean: {
src: [ 'assets/js/main.js', 'assets/css/main.css.map' ]
},
sass: {
dev: {
files: {
'assets/css/main.css': 'source/sass/main.scss'
}
}
},
browserSync: {
dev: {
bsFiles: {
src: [
'assets/css/main.css',
'assets/*.html',
'assets/js/main.min.js'
]
},
options: {
watchTask: true,
server: './assets'
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'assets/index.html': 'source/index.html'
}
}
},
jshint: {
dist: {
src: 'source/js/**/*.js'
}
},
concat: {
scripts: {
src: 'source/js/**/*.js',
dest: 'assets/js/main.js'
}
},
uglify: {
dest: {
src: 'assets/js/main.js',
dest: 'assets/js/main.min.js'
}
},
cssmin: {
dist: {
src: 'assets/css/main.css',
dest: 'assets/css/main.css'
}
},
watch: {
files: [
'source/sass/**/*.scss',
'source/*.html',
'source/js/**/*.js'
],
tasks: [ 'sass', 'htmlmin', 'jshint', 'concat', 'uglify', 'cssmin', 'clean' ]
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('default', [ 'sass', 'browserSync', 'htmlmin', 'jshint', 'concat', 'uglify', 'cssmin', 'clean', 'watch']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment