| @@ -39,9 +39,9 @@ | ||
| 39 | 39 | |
| 40 | 40 | // styles related |
| 41 | 41 | gulp.task('styles-dev', function () { |
| 42 | 42 | return gulp.src(source_SCSS) |
| 43 | - .pipe(sass({'sourcemap': false, style: 'compact'})) | |
| 43 | + .pipe(sass({'sourcemap': true, outputStyle: 'expanded'})) | |
| 44 | 44 | .on('error', function (e) { |
| 45 | 45 | console.log(e.message); |
| 46 | 46 | }) |
| 47 | 47 | .pipe(prefix("last 1 version", "> 1%", "ie 8", "ie 7")) |
| @@ -54,15 +54,15 @@ | ||
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | 56 | gulp.task('styles', function () { |
| 57 | 57 | return gulp.src(source_SCSS) |
| 58 | - .pipe(sass({'sourcemap': true, style: 'expanded'})) | |
| 58 | + .pipe(sass({'sourcemap': false, outputStyle: 'compressed'})) | |
| 59 | 59 | .pipe(prefix("last 1 version", "> 1%", "ie 8", "ie 7")) |
| 60 | 60 | .pipe(csscomb()) |
| 61 | 61 | .pipe(gulp.dest(dest_CSS, {"mode": "0644"})) |
| 62 | 62 | }); |
| 63 | 63 | |
| 64 | -gulp.task('styles-watch', function () { | |
| 64 | +gulp.task('styles-watch', [ 'styles-dev' ], function () { | |
| 65 | 65 | return gulp.watch(source_SCSS, ['styles']); |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | 68 | // javascript stuff |
| @@ -90,17 +90,36 @@ | ||
| 90 | 90 | gulp.task('server', ['styles', 'scripts'], function () { |
| 91 | 91 | console.log('The styles and scripts have been compiled for production! Go and clear the caches!'); |
| 92 | 92 | }); |
| 93 | 93 | |
| 94 | - | |
| 95 | 94 | /** |
| 96 | 95 | * Create a zip archive out of the cleaned folder and delete the folder |
| 97 | 96 | */ |
| 98 | 97 | gulp.task( 'zip', ['build'], function() { |
| 98 | + var versionString = ''; | |
| 99 | + // get plugin version from the main plugin file | |
| 100 | + var contents = fs.readFileSync("./" + plugin + ".php", "utf8"); | |
| 99 | 101 | |
| 100 | - return gulp.src( './' ) | |
| 101 | - .pipe( exec( 'cd ./../; rm -rf customify.zip; cd ./build/; zip -r -X ./../customify.zip ./customify; cd ./../; rm -rf build' ) ); | |
| 102 | + // split it by lines | |
| 103 | + var lines = contents.split(/[\r\n]/); | |
| 102 | 104 | |
| 105 | + function checkIfVersionLine(value, index, ar) { | |
| 106 | + var myRegEx = /^[\s\*]*[Vv]ersion:/; | |
| 107 | + if (myRegEx.test(value)) { | |
| 108 | + return true; | |
| 109 | + } | |
| 110 | + return false; | |
| 111 | + } | |
| 112 | + | |
| 113 | + // apply the filter | |
| 114 | + var versionLine = lines.filter(checkIfVersionLine); | |
| 115 | + | |
| 116 | + versionString = versionLine[0].replace(/^[\s\*]*[Vv]ersion:/, '').trim(); | |
| 117 | + versionString = '-' + versionString.replace(/\./g, '-'); | |
| 118 | + | |
| 119 | + return gulp.src('./') | |
| 120 | + .pipe(exec('cd ./../; rm -rf ' + plugin[0].toUpperCase() + plugin.slice(1) + '*.zip; cd ./build/; zip -r -X ./../' + plugin[0].toUpperCase() + plugin.slice(1) + versionString + '.zip ./; cd ./../; rm -rf build')); | |
| 121 | + | |
| 103 | 122 | } ); |
| 104 | 123 | |
| 105 | 124 | /** |
| 106 | 125 | * Copy theme folder outside in a build folder, recreate styles before that |
| @@ -122,8 +141,9 @@ | ||
| 122 | 141 | 'node_modules', |
| 123 | 142 | 'config.rb', |
| 124 | 143 | 'gulpfile.js', |
| 125 | 144 | 'package.json', |
| 145 | + 'package-lock.json', | |
| 126 | 146 | 'pxg.json', |
| 127 | 147 | 'build', |
| 128 | 148 | '.idea', |
| 129 | 149 | '**/*.css.map', |
| @@ -134,9 +154,20 @@ | ||
| 134 | 154 | '__MACOSX', |
| 135 | 155 | '**/__MACOSX', |
| 136 | 156 | '+development.rb', |
| 137 | 157 | '+production.rb', |
| 138 | - 'README.md' | |
| 158 | + 'README.md', | |
| 159 | + '.labels', | |
| 160 | + '.csscomb', | |
| 161 | + '.csscomb.json', | |
| 162 | + '.codeclimate.yml', | |
| 163 | + 'tests', | |
| 164 | + 'circle.yml', | |
| 165 | + '.circleci', | |
| 166 | + '.labels', | |
| 167 | + '.jscsrc', | |
| 168 | + '.jshintignore', | |
| 169 | + 'browserslist' | |
| 139 | 170 | ]; |
| 140 | 171 | |
| 141 | 172 | files_to_remove.forEach( function( e, k ) { |
| 142 | 173 | files_to_remove[k] = '../build/customify/' + e; |