Last active
August 29, 2015 14:00
-
-
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.
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) { | |
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'); | |
}; |
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": "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