Last active
August 29, 2015 14:19
-
-
Save tanmancan/34477e4a64cc2db20158 to your computer and use it in GitHub Desktop.
Starter grunt tasks and plugins
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) { | |
// Auto load plugins | |
require('load-grunt-tasks')(grunt); | |
// Project configuration | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
// Javascript linter | |
jshint: { | |
all: ['Gruntfile.js', '*.js'] | |
}, | |
// Minify scripts | |
uglify: { | |
options: { | |
mangle: false | |
}, | |
main: { | |
files: { | |
'*.min.js': ['*.js'] | |
} | |
} | |
}, | |
// Compile SASS | |
sass: { | |
options: { | |
includePaths: ['*/scss'] | |
}, | |
// Production | |
dist: { | |
options: { | |
outputStyle: 'compressed', | |
sourceMap: false | |
}, | |
files: { | |
'css/*.min.css': 'scss/*.scss' | |
} | |
}, | |
// Development | |
dev: { | |
options: { | |
outputStyle: 'expanded', | |
sourceMap: true | |
}, | |
files: { | |
'css/*.css': 'scss/*.scss' | |
} | |
} | |
}, | |
// Watch and live reload | |
watch: { | |
sass: { | |
files: ['*.scss'], | |
tasks: ['sass:dev'] | |
}, | |
other: { | |
files: ['*.html', '*.js', '*.php'] | |
}, | |
// Live reload on file changes | |
options: { | |
livereload: true | |
} | |
} | |
}); | |
//Default task(s) | |
grunt.registerTask('livereload', ['watch']); | |
grunt.registerTask('checkjs', ['jshint']); | |
grunt.registerTask('default', ['uglify', 'sass']); | |
}; |
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
{ | |
"name": "grunt-starter", | |
"version": "1.0.0", | |
"description": "Starter grunt tasks and plugins", | |
"main": "Gruntfile.js", | |
"dependencies": { | |
"grunt-cli": "^0.1.13" | |
}, | |
"devDependencies": { | |
"node-sass": "~2.0.1", | |
"grunt": "^0.4.5", | |
"grunt-contrib-jshint": "^0.11.1", | |
"grunt-contrib-uglify": "^0.7.0", | |
"grunt-contrib-watch": "^0.6.1", | |
"grunt-sass": "^0.18.0", | |
"load-grunt-tasks": "^3.1.0" | |
}, | |
"author": "Tanveer Karim", | |
"license": "MIT", | |
"scripts": { | |
"postinstall": "grunt" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment