Skip to content

Commit

Permalink
JS Minification: do not rename files when minificating (#11080)
Browse files Browse the repository at this point in the history
#### Changes proposed in this Pull Request:

In #11079 I replaced `gulp-uglify` by `gulp-minify` to solve some issues.
`gulp-minify` works a bit differently and requires you to specify when you want to create files without the min suffix.

#### Testing instructions:

* Run `yarn build-production-client`
* Make sure the files generated in `_inc/build` are similar to the ones in previous builds:
https://github.com/Automattic/jetpack/tree/branch-6.8-built/_inc/build
https://github.com/Automattic/jetpack/tree/branch-6.8-built/_inc/build/after-the-deadline
* There should be no extra `min` files

#### Proposed changelog entry for your changes:

* None
  • Loading branch information
jeherve authored Jan 4, 2019
1 parent f1d3de5 commit 7a76cce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/builder/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ function onBuild( done, err, stats ) {
log( 'Uglifying JS...' );
gulp
.src( '_inc/build/admin.js' )
.pipe( minify() )
.pipe( minify( {
noSource: true,
ext: { min: '.js' },
} ) )
.pipe( gulp.dest( '_inc/build' ) )
.on( 'end', function() {
log( 'Your JS is now uglified!' );
Expand Down Expand Up @@ -143,6 +146,8 @@ function onBuild( done, err, stats ) {
output: {
comments: saveLicense,
},
noSource: true,
ext: { min: '.js' },
} )
)
.pipe( rename( { suffix: '.min' } ) )
Expand Down

0 comments on commit 7a76cce

Please sign in to comment.