Skip to content

Commit

Permalink
Update Gruntfile for version replacement and file cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyrob committed Apr 8, 2021
1 parent c88de7a commit f9802b4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ module.exports = function( grunt ) {
options: {
force: true
},
build: [
minified: [
SOURCE_DIR + './include/*.min.js',
SOURCE_DIR + './include/*.min.css',
SOURCE_DIR + './tinymce/*.min.js'
],
zip: [
SOURCE_DIR + 'subscribe2.zip'
]
},
prompt: {
Expand Down Expand Up @@ -169,10 +172,10 @@ module.exports = function( grunt ) {
version: {
options: {
patterns: [ {
match: /^define\( 'S2VERSION', '(\d+\.\d+)' \);$/gm,
match: /^define\(\s'[\w]*',\s'(\d+\.\d+[\.]?[\d]*)'\s\);$/m,
replacement: function() {
var file = grunt.file.read( SOURCE_DIR + 'subscribe2.php' );
var regex = /^Version: (\d+\.+\d+)$/m;
var regex = /^[\w]*:\s(\d+\.\d+[\.]?[\d]*)$/m;
var matches = file.match( regex );
return 'define( \'S2VERSION\', \'' + matches[1] + '\' );';
}
Expand Down Expand Up @@ -335,7 +338,7 @@ module.exports = function( grunt ) {
grunt.registerTask(
'build',
[
'clean:build',
'clean:minified',
'addtextdomain:s2cp',
'csscomb',
'terser',
Expand Down

0 comments on commit f9802b4

Please sign in to comment.