Created
September 9, 2013 16:05
-
-
Save mattbanks/6497797 to your computer and use it in GitHub Desktop.
Grunt LiveReload issue - package.json and Gruntfile.js
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 matching the `grunt-*` pattern | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
// watch for changes and trigger compass, jshint, uglify and livereload | |
watch: { | |
compass: { | |
files: ['assets/scss/**/*.{scss,sass}'], | |
tasks: ['compass'] | |
}, | |
js: { | |
files: '<%= jshint.all %>', | |
tasks: ['jshint', 'uglify'] | |
}, | |
livereload: { | |
options: { livereload: true }, | |
files: ['style.css', 'assets/js/*.js', '*.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: { | |
plugins: { | |
options: { | |
sourceMap: 'assets/js/plugins.js.map', | |
sourceMappingURL: 'plugins.js.map', | |
sourceMapPrefix: 2 | |
}, | |
files: { | |
'assets/js/plugins.min.js': [ | |
'assets/js/source/plugins.js', | |
// 'assets/js/vendor/yourplugin/yourplugin.js', | |
] | |
} | |
}, | |
main: { | |
options: { | |
sourceMap: 'assets/js/main.js.map', | |
sourceMappingURL: 'main.js.map', | |
sourceMapPrefix: 2 | |
}, | |
files: { | |
'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: { | |
options: { | |
args: ["--verbose"], | |
src: "./", | |
exclude: ['.git*', 'node_modules', '.sass-cache', 'Gruntfile.js', 'package.json', '.DS_Store', 'README.md', 'config.rb', '.jshintrc'], | |
recursive: true, | |
syncDestIgnoreExcl: true | |
}, | |
staging: { | |
dest: "~/path/to/theme", | |
host: "[email protected]" | |
}, | |
production: { | |
dest: "~/path/to/theme", | |
host: "[email protected]" | |
} | |
} | |
}); | |
// rename tasks | |
grunt.renameTask('rsync', 'deploy'); | |
// register task | |
grunt.registerTask('default', ['watch']); | |
}; |
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
{ | |
"name": "wordpress-starter-theme", | |
"version": "1.0.0", | |
"dependencies": { | |
"load-grunt-tasks": "~0.1.0" | |
}, | |
"devDependencies": { | |
"grunt": "~0.4.1", | |
"grunt-contrib-compass": "~0.5.0", | |
"grunt-contrib-imagemin": "~0.2.0", | |
"grunt-contrib-jshint": "~0.6.4", | |
"grunt-contrib-uglify": "~0.2.4", | |
"grunt-contrib-watch": "~0.5.3", | |
"grunt-rsync": "~0.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment