Grunt build: Use string replace to update version #

This commit is contained in:
Mottie 2015-02-20 18:48:25 -06:00
parent 1f6b343eb9
commit 146a5ff2ea
3 changed files with 21 additions and 5 deletions

View File

@ -57,7 +57,7 @@ module.exports = function( grunt ) {
console.info( 'Creating a widgets file with: ' + pkg.selectedWidgets.join(', ') );
};
// minified banner template - updated 2/9/2015 (v2.19.1)
// minified banner template - updated ##/##/20## (v2.##.##)
pkg.banner = '/*! <%= pkg.name %> (FORK) widgets - updated ' +
'<%= grunt.template.today("mm-dd-yyyy") %> (v<%= pkg.version %>)*/\n';
@ -200,6 +200,20 @@ module.exports = function( grunt ) {
}
},
'string-replace': {
dist: {
files: {
'dist/js/': ['dist/js/*.js']
},
options: {
replacements: [{
pattern: /\{\{version\}\}/ig,
replacement: '<%= pkg.version %>'
}]
}
}
},
cssmin: {
target: {
files: [{
@ -240,6 +254,7 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks('grunt-string-replace');
grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
@ -251,6 +266,7 @@ module.exports = function( grunt ) {
'uglify',
'cssmin',
'clean:css',
'string-replace',
'updateManifest'
];

View File

@ -24,8 +24,8 @@
<!-- Tablesorter: required -->
<link href="../css/theme.blue.css" rel="stylesheet">
<script src="../js/jquery.tablesorter.js"></script>
<script src="../js/jquery.tablesorter.widgets.js"></script>
<script src="../dist/js/jquery.tablesorter.js"></script>
<script src="../dist/js/jquery.tablesorter.widgets.js"></script>
<script>
$(function() {
$.extend( $.tablesorter.defaults, {

View File

@ -1,4 +1,4 @@
/*! TableSorter (FORK) v2.19.1 *//*
/*! TableSorter (FORK) v{{version}} *//*
* Client-side table sorting with ease!
* @requires jQuery v1.2.6+
*
@ -34,7 +34,7 @@
var ts = this;
ts.version = '2.19.1';
ts.version = '{{version}}';
ts.parsers = [];
ts.widgets = [];