Created
July 16, 2014 21:32
-
-
Save mitchthorson/74c9b7d7a54e396bea13 to your computer and use it in GitHub Desktop.
Sample Gruntfile
This file contains 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'), | |
sass: { | |
dist: { | |
options: { | |
sourcemap: true, | |
style: 'compressed' | |
}, | |
files: { | |
'css/scss/project.noprefix.css': 'css/scss/project.scss' | |
} | |
} | |
}, | |
autoprefixer: { | |
options: { | |
// Task-specific options go here. | |
}, | |
single_file: { | |
options: { | |
map: true | |
}, | |
src: 'css/scss/project.noprefix.css', | |
dest: 'css/project.css' | |
} | |
}, | |
jshint: { | |
all: ['Gruntfile.js', 'js/base.js'] | |
}, | |
uglify: { | |
my_target: { | |
options: { | |
sourceMap: true | |
}, | |
files: { | |
'js/base.min.js': ['js/base.js'] | |
} | |
} | |
}, | |
watch: { | |
styles: { | |
files: ['css/scss/*.scss'], | |
tasks: ['sass', 'autoprefixer'] | |
}, | |
js: { | |
files: ['js/base.js'], | |
tasks: ['jshint', 'uglify'] | |
}, | |
html: { | |
files: ['index.html'], | |
tasks: [] | |
}, | |
options: { | |
livereload: true, | |
} | |
}, | |
connect: { | |
options: { | |
port: 9000, | |
// Change this to '0.0.0.0' to access the server from outside. | |
hostname: 'localhost', | |
livereload: 35729 | |
}, | |
livereload: { | |
options: { | |
open: true, | |
} | |
} | |
}, | |
} | |
}); | |
// Load the plugins. | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-autoprefixer'); | |
grunt.loadNpmTasks('grunt-contrib-connect'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-execute'); | |
// Default task(s). | |
grunt.registerTask('default', ['sass', 'autoprefixer', 'jshint', 'uglify', 'connect:livereload', 'watch']); | |
grunt.registerTask('update', ['execute', 'default']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment