Skip to content

Instantly share code, notes, and snippets.

@fikrirasyid
Last active August 29, 2015 14:19
Show Gist options
  • Save fikrirasyid/95c12103753f9f2352ca to your computer and use it in GitHub Desktop.
Save fikrirasyid/95c12103753f9f2352ca to your computer and use it in GitHub Desktop.
Gruntfile.js for making .zip file for Patio theme
'use strict';
module.exports = function(grunt){
// load all tasks
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
makepot: {
target: {
options: {
domainPath: '/languages/', // Where to save the POT file.
potFilename: '<%= pkg.name %>.pot', // Name of the POT file.
type: 'wp-theme' // Type of project (wp-plugin or wp-theme).
}
}
},
clean: {
init: {
src: ['build/']
},
build: {
src: ['build/*', '!build/<%= pkg.name %>.zip']
}
},
copy: {
readme: {
src: 'readme.md',
dest: 'build/readme.txt'
},
build: {
expand: true,
src: ['**', '!node_modules/**', '!build/**', '!readme.md', '!Gruntfile.js', '!package.json' ],
dest: 'build/'
}
},
compress: {
build: {
options: {
archive: 'build/<%= pkg.name %>.zip'
},
expand: true,
cwd: 'build/',
src: ['**/*'],
dest: '<%= pkg.name %>/'
}
}
});
grunt.registerTask('default', []);
// Build task
grunt.registerTask( 'build', [
'makepot',
'clean:init',
'copy',
'compress:build',
'clean:build'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment