Skip to content

Instantly share code, notes, and snippets.

@zeropointdevelopment
Last active January 1, 2016 11:59
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 zeropointdevelopment/8141192 to your computer and use it in GitHub Desktop.
Save zeropointdevelopment/8141192 to your computer and use it in GitHub Desktop.
[WordPress] Code examples from our blog post - Installing and Using Grunt http://www.limecanvas.com/installing-and-using-grunt/
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// 2. The plugin configuration
uglify: {
my_target: {
files: {
'js/admin.min.js': ['js/admin.js']
}
}
}
});
// 3. Where we tell Grunt we plan to use this plugin.
grunt.loadNpmTasks('grunt-contrib-uglify');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['uglify']);
};
{
"name": "test-project",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.7"
}
}
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
my_target: {
files: {
'js/admin.min.js': ['js/admin.js']
}
}
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'images/',
src: ['**/*.{png,jpg,gif}'],
dest: 'images/opt/'
}]
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['uglify', 'imagemin']);
};
{
"name": "test-project",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment