-
-
Save ellefsen/879511004a9ab349d74a to your computer and use it in GitHub Desktop.
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
'use strict'; | |
module.exports = function(grunt) { | |
// load all grunt tasks | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
grunt.initConfig({ | |
// watch for changes and trigger compass, jshint, uglify and livereload | |
watch: { | |
options: { | |
livereload: true, | |
}, | |
compass: { | |
files: ['assets/scss/**/*.{scss,sass}'], | |
tasks: ['compass'] | |
}, | |
js: { | |
files: '<%= jshint.all %>', | |
tasks: ['jshint', 'uglify'] | |
}, | |
livereload: { | |
files: ['*.html', '*.php', 'assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}'] | |
} | |
}, | |
// compass and scss | |
compass: { | |
dist: { | |
options: { | |
config: 'config.rb', | |
force: true | |
} | |
} | |
}, | |
// javascript linting with jshint | |
jshint: { | |
options: { | |
jshintrc: '.jshintrc', | |
"force": true | |
}, | |
all: [ | |
'Gruntfile.js', | |
'assets/js/source/**/*.js' | |
] | |
}, | |
// uglify to concat, minify, and make source maps | |
uglify: { | |
dist: { | |
options: { | |
sourceMap: 'assets/js/map/source-map.js' | |
}, | |
files: { | |
'assets/js/plugins.min.js': [ | |
'assets/js/source/plugins.js', | |
'assets/js/vendor/**/*.js', | |
'!assets/js/vendor/modernizr*.js' | |
], | |
'assets/js/main.min.js': [ | |
'assets/js/source/main.js' | |
] | |
} | |
} | |
}, | |
// image optimization | |
imagemin: { | |
dist: { | |
options: { | |
optimizationLevel: 7, | |
progressive: true | |
}, | |
files: [{ | |
expand: true, | |
cwd: 'assets/images/', | |
src: '**/*', | |
dest: 'assets/images/' | |
}] | |
} | |
}, | |
// deploy via rsync | |
deploy: { | |
staging: { | |
src: "./", | |
dest: "~/path/to/theme", | |
host: "user@host.com", | |
recursive: true, | |
syncDest: true, | |
exclude: ['.git*', 'node_modules', '.sass-cache', 'Gruntfile.js', 'package.json', '.DS_Store', 'README.md', 'config.rb', '.jshintrc'] | |
}, | |
production: { | |
src: "./", | |
dest: "~/path/to/theme", | |
host: "user@host.com", | |
recursive: true, | |
syncDest: true, | |
exclude: '<%= rsync.staging.exclude %>' | |
} | |
} | |
}); | |
// rename tasks | |
grunt.renameTask('rsync', 'deploy'); | |
// register task | |
grunt.registerTask('default', ['watch']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment