Skip to content

Instantly share code, notes, and snippets.

@jlengstorf
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlengstorf/11004263 to your computer and use it in GitHub Desktop.
Save jlengstorf/11004263 to your computer and use it in GitHub Desktop.
Standard Grunt setup for a WordPress theme. Place in the theme's root.
module.exports = function(grunt) {
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
uglify: {
options: {
mangle: true,
compress: true,
preserveComments: 'some'
},
js: {
files: {
'assets/js/main.min.js': ['assets/js/main.js']
}
}
},
less: {
style: {
options: {
cleancss: true,
},
files: {
'assets/css/main.min.css': 'assets/less/main.less',
}
}
},
watch: {
js: {
files: ['assets/js/*.js'],
tasks: ['uglify:js'],
options: {
livereload: true,
}
},
css: {
files: [
'assets/less/*.less',
],
tasks: ['less:style'],
options: {
livereload: true,
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
};
{
"name": "theme-name",
"version": "0.1.0",
"dependencies": {
"grunt-cli": "latest",
"grunt-contrib-concat": "latest",
"grunt-contrib-uglify": "latest",
"grunt-contrib-less": "latest",
"grunt-contrib-watch": "latest"
},
"devDependencies": {
"grunt-notify": "~0.2.17"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment