Skip to content

Instantly share code, notes, and snippets.

@bmuenzenmeyer
Created October 28, 2014 05:09
Show Gist options
  • Save bmuenzenmeyer/9dd62b9def7c8e5fc55c to your computer and use it in GitHub Desktop.
Save bmuenzenmeyer/9dd62b9def7c8e5fc55c to your computer and use it in GitHub Desktop.
A simple gruntfile to extract Wordpress theme and plugin assets for concatenation and minification
'use strict';
module.exports = function(grunt){
grunt.initConfig({
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'../wp-content/themes/SiteName/style.css': 'scss/main.scss'
}
}
},
concat: {
options: {
seperator: ';',
},
concatenated: {
files: {
'dist/site.js' : [
'../wp-content/plugins/contact-form-7/includes/js/jquery.form.min.js',
'../wp-content/plugins/contact-form-7/includes/js/scripts.js',
'../wp-content/themes/SiteName/js/jquery-migrate.min.js',
'../wp-content/themes/SiteName/js/site.js'
]
}
}
},
uglify: {
min: {
files: { 'dist/site.min.js': 'dist/site.js' }
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.registerTask('default', ['sass', 'concat', 'uglify']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment