Skip to content

Instantly share code, notes, and snippets.

@raidenz
Last active November 29, 2016 17:09
Show Gist options
  • Save raidenz/130abdca9ecb74252944 to your computer and use it in GitHub Desktop.
Save raidenz/130abdca9ecb74252944 to your computer and use it in GitHub Desktop.
wp grunt fikrirasyid
'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 .pot file
grunt.registerTask( 'buildpot', [
'makepot'
]);
// Build task
grunt.registerTask( 'build', [
'makepot',
'clean:init',
'copy',
'compress:build',
'clean:build'
]);
};
{
"name": "automator",
"version": "1.0.1",
"author": "Tomi",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cli" : "~0.1.13",
"load-grunt-tasks": "~0.4.0",
"grunt-wp-i18n" : "~0.4.3",
"grunt-contrib-copy" : "~0.8.0",
"grunt-contrib-clean" : "~0.6.0",
"grunt-contrib-compress" : "~0.13.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment