Skip to content

Commit

Permalink
17: Introduce Grunt based minification of JS and CSS (#686)
Browse files Browse the repository at this point in the history
* Introduce Grunt based minification of JS and CSS

* Update package versions to latest, update config

* Update minified files

* Add missing comma

* Add jshint hints for Gruntfile.js

* Remove incompatible esversion

* Fix JSHint issues by using old syntax for now

Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com>
  • Loading branch information
yoavf and ocean90 committed Apr 10, 2020
1 parent 80165f9 commit 7874da6
Show file tree
Hide file tree
Showing 12 changed files with 1,181 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,6 @@
# Composer
composer.lock
/vendor/

npm-debug.log
node_modules
52 changes: 52 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,52 @@
/* jshint node:true */
module.exports = function( grunt ) {
var WORKING_DIR = '.';

require( 'load-grunt-tasks' )( grunt );

grunt.initConfig( {
uglify: {
options: {
output: {
ascii_only: true
}
},
core: {
expand: true,
cwd: WORKING_DIR,
dest: WORKING_DIR,
src: [
'assets/js/**/*.js',

// Exceptions.
'!**/*.min.js'
],

// Custom rename function to support files with multiple dots.
rename: function( dst, src ) {
return src.replace( '.js', '.min.js' );
}
}
},
cssmin: {
core: {
expand: true,
cwd: WORKING_DIR,
dest: WORKING_DIR,
src: [
'assets/css/*.css',

// Exceptions.
'!**/*.min.css'
],

// Custom rename function to support files with multiple dots.
rename: function( dst, src ) {
return src.replace( '.css', '.min.css' );
}
}
}
} );

grunt.registerTask( 'default', [ 'uglify', 'cssmin' ] );
};
2 changes: 1 addition & 1 deletion assets/css/style.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/tablesorter.theme.glotpress.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/common.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7874da6

Please sign in to comment.