Skip to content

Commit cba2dce

Browse files
committed
Gruntified
1 parent 155e77b commit cba2dce

9 files changed

Lines changed: 281 additions & 0 deletions

File tree

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*.zip
2+
.DS_Store
3+
4+
# Grunt.js SASS cache files
5+
/.sass-cache
6+
7+
# NPM packages used by Grunt.js
8+
/node_modules
9+
10+
# NPM debug log
11+
npm-debug.log
12+
13+
# build directory
14+
/build
15+
16+
.idea/

Gruntfile.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* jshint node:true */
2+
module.exports = function( grunt ) {
3+
'use strict';
4+
5+
// load all grunt tasks matching the `grunt-*` pattern
6+
require( 'load-grunt-tasks' )( grunt );
7+
8+
// Show elapsed time
9+
require( 'time-grunt' )( grunt );
10+
11+
var _ = require( 'underscore' );
12+
var path = require( 'path' );
13+
14+
// Set plugin slug option
15+
grunt.option( 'plugin-slug', path.basename( process.cwd() ) );
16+
17+
var gruntConfig = {};
18+
19+
// options
20+
gruntConfig.options = {};
21+
22+
// Set folder templates
23+
gruntConfig.dirs = {
24+
css: 'assets/css',
25+
js: 'assets/js',
26+
images: 'assets/images',
27+
fonts: 'assets/fonts',
28+
build: 'build'
29+
};
30+
31+
function loadConfig( filepath ) {
32+
var object = {};
33+
var key;
34+
35+
filepath = path.normalize( path.resolve( process.cwd(), filepath ) + '/' )
36+
37+
var files = grunt.file.glob.sync( '*', { cwd: filepath } );
38+
39+
files.forEach( function( option ) {
40+
key = option.replace(/\.js$/,'');
41+
object = _.extend( object, require( filepath + option )( grunt ) );
42+
});
43+
44+
return object;
45+
};
46+
47+
// load task configs
48+
gruntConfig = _.extend( gruntConfig, loadConfig( './grunt/configs/' ) );
49+
50+
// Init Grunt
51+
grunt.initConfig( gruntConfig );
52+
53+
// Register Tasks
54+
grunt.registerTask( 'default', [
55+
'makepot',
56+
'clean:build_dir',
57+
'copy:build',
58+
'clean:build'
59+
] );
60+
};

grunt/configs/clean.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/* jshint node:true */
2+
module.exports = function( grunt ) {
3+
'use strict';
4+
5+
var _ = require( 'underscore' );
6+
var config = {};
7+
8+
// Delete source map from the CoffeeScript compilation
9+
config.clean = {
10+
dev: [ '<%= dirs.js %>/admin/*.min.js.map', '<%= dirs.js %>/frontend/*.min.js.map' ],
11+
build_dir: [ '<%= dirs.build %>/**' ],
12+
build: [
13+
// Delete dev files and dirs
14+
'<%= dirs.build %>/grunt',
15+
'<%= dirs.build %>/node_modules',
16+
'<%= dirs.build %>/wp-assets',
17+
'<%= dirs.build %>/package.json',
18+
'<%= dirs.build %>/Gruntfile.js',
19+
20+
// Delete map files
21+
'<%= dirs.build %>/<%= dirs.js %>/admin/*.map',
22+
'<%= dirs.build %>/<%= dirs.js %>/frontend/*.map',
23+
'<%= dirs.build %>/<%= dirs.css %>/admin/*.map',
24+
'<%= dirs.build %>/<%= dirs.css %>/frontend/*.map',
25+
26+
// Delete .coffee files
27+
'<%= dirs.build %>/<%= dirs.js %>/admin/*.coffee',
28+
'<%= dirs.build %>/<%= dirs.js %>/frontend/*.coffee',
29+
30+
// Delete unminified .js files
31+
'<%= dirs.build %>/<%= dirs.js %>/admin/*.js',
32+
'<%= dirs.build %>/<%= dirs.js %>/frontend/*.js',
33+
'!<%= dirs.build %>/<%= dirs.js %>/admin/*.min.js',
34+
'!<%= dirs.build %>/<%= dirs.js %>/frontend/*.min.js',
35+
36+
// Delete .scss files
37+
'<%= dirs.build %>/<%= dirs.css %>/admin/*.scss',
38+
'<%= dirs.build %>/<%= dirs.css %>/frontend/*.scss',
39+
40+
// Delete unminified .css files
41+
'<%= dirs.build %>/<%= dirs.css %>/admin/*.css',
42+
'<%= dirs.build %>/<%= dirs.css %>/frontend/*.css',
43+
'!<%= dirs.build %>/<%= dirs.css %>/admin/*.min.css',
44+
'!<%= dirs.build %>/<%= dirs.css %>/frontend/*.min.css',
45+
46+
// Delete misc files
47+
'<%= dirs.build %>/modman',
48+
'<%= dirs.build %>/**.DS_Store',
49+
'<%= dirs.build %>/**.zip'
50+
]
51+
};
52+
53+
return config;
54+
};

grunt/configs/copy.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* jshint node:true */
2+
module.exports = function( grunt ) {
3+
'use strict';
4+
5+
var util = grunt.option( 'util' );
6+
var config = {};
7+
8+
function cleanSourceMaps( content, srcpath ) {
9+
10+
if ( '.min.js' == srcpath.match( '.min.js$' ) || '.min.css' == srcpath.match( '.min.css$' ) ) { // jshint ignore:line
11+
content = content.replace( /^.*sourceMappingURL=.*$/mg, '' );
12+
}
13+
14+
return content;
15+
}
16+
17+
// copy files to /build dir
18+
config.copy = {
19+
build: {
20+
files: [{
21+
expand: true,
22+
src: [ '**' ],
23+
dest: 'build/'
24+
}],
25+
options: {
26+
process: cleanSourceMaps,
27+
noProcess: [
28+
'**/*.{png,jpg,gif}',
29+
'**/*.{eot,svg,ttf,woff}'
30+
]
31+
}
32+
}
33+
};
34+
35+
return config;
36+
};

grunt/configs/makepot.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* jshint node:true */
2+
module.exports = function( grunt ) {
3+
'use strict';
4+
5+
var config = {};
6+
7+
// Makepot
8+
config.makepot = {
9+
makepot: {
10+
options: {
11+
cwd: '',
12+
domainPath: 'i18n/languages',
13+
potFilename: grunt.option( 'plugin-slug' ) + '.pot',
14+
potHeaders: { 'report-msgid-bugs-to': 'https://github.com/skyverge/' + grunt.option( 'plugin-slug' ) + '/issues' },
15+
processPot: function( pot ) {
16+
delete pot.headers['x-generator'];
17+
return pot;
18+
}, // jshint ignore:line
19+
type: 'wp-plugin',
20+
updateTimestamp: false
21+
}
22+
}
23+
};
24+
25+
26+
return config;
27+
};

grunt/configs/wp_deploy.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* jshint node:true */
2+
module.exports = function( grunt ) {
3+
'use strict';
4+
5+
var config = {};
6+
7+
// Makepot
8+
config.wp_deploy = {
9+
deploy: {
10+
options: {
11+
plugin_slug: grunt.option( 'plugin-slug' ),
12+
svn_user: 'beka.rice',
13+
build_dir: 'build',
14+
assets_dir: 'wp-assets'
15+
}
16+
}
17+
};
18+
19+
return config;
20+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (C) 2015 SkyVerge
2+
# This file is distributed under the GNU General Public License v3.0.
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: WooCommerce Filter Orders by Coupon 1.0.0\n"
6+
"Report-Msgid-Bugs-To: "
7+
"https://github.com/skyverge/woocommerce-filter-orders-by-coupon/issues\n"
8+
"POT-Creation-Date: 2015-03-08 23:31:17+00:00\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=utf-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
13+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14+
"Language-Team: LANGUAGE <LL@li.org>\n"
15+
16+
#: build/woocommerce-filter-orders-by-coupon.php:106
17+
#: woocommerce-filter-orders-by-coupon.php:106
18+
msgid "Filter by coupon used"
19+
msgstr ""
20+
21+
#. Plugin Name of the plugin/theme
22+
msgid "WooCommerce Filter Orders by Coupon"
23+
msgstr ""
24+
25+
#. Plugin URI of the plugin/theme
26+
msgid "http://www.skyverge.com/product/woocommerce-filter-orders/"
27+
msgstr ""
28+
29+
#. Description of the plugin/theme
30+
msgid "Adds the ability to filter orders by the coupon used."
31+
msgstr ""
32+
33+
#. Author of the plugin/theme
34+
msgid "SkyVerge"
35+
msgstr ""
36+
37+
#. Author URI of the plugin/theme
38+
msgid "http://www.skyverge.com/"
39+
msgstr ""

package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "woocommerce-extra-product-sorting-options",
3+
"version": "1.2.0",
4+
"author": "Beka Rice",
5+
"homepage": "http://bekarice.com",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/bekarice/woocommerce-extra-product-sorting-options.git"
9+
},
10+
"bugs": {
11+
"url": "https://github.com/bekarice/woocommerce-extra-product-sorting-options/issues"
12+
},
13+
"engines": {
14+
"node": ">= 0.10.0"
15+
},
16+
"devDependencies": {
17+
"grunt": "~0.4.5",
18+
"grunt-contrib-clean": "~0.5.0",
19+
"grunt-contrib-copy": "~0.5.0",
20+
"grunt-newer": "~0.7.0",
21+
"grunt-notify": "~0.3.0",
22+
"grunt-wp-deploy": "~1.0.3",
23+
"grunt-wp-i18n": "~0.4.5",
24+
"load-grunt-tasks": "~0.6.0",
25+
"time-grunt": "~0.4.0",
26+
"underscore": "~1.6.0",
27+
"underscore.string": "~2.3.3"
28+
}
29+
}

wp-assets/screenshot-1.png

42.3 KB
Loading

0 commit comments

Comments
 (0)