Last active
January 1, 2016 11:59
-
-
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/
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) { | |
// 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']); | |
}; |
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": "test-project", | |
"version": "0.1.0", | |
"devDependencies": { | |
"grunt": "~0.4.1", | |
"grunt-contrib-uglify": "~0.2.7" | |
} | |
} |
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) { | |
// 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']); | |
}; |
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": "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