Skip to content

Commit

Permalink
Replace uglify-js with uglify-es since it supports ES6 minification #48
Browse files Browse the repository at this point in the history
  • Loading branch information
maltsev committed Apr 17, 2018
1 parent e8c1f19 commit 4c273dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/modules/minifyJs.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uglifyJs from 'uglify-js';
import uglifyJs from 'uglify-es';


/** Minify JS with UglifyJS */
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"posthtml": "^0.11.3",
"posthtml-render": "^1.1.3",
"svgo": "^1.0.5",
"uglify-js": "^3.3.14"
"uglify-es": "^3.3.9"
},
"devDependencies": {
"babel-cli": "^6.26.0",
Expand Down
11 changes: 11 additions & 0 deletions test/modules/minifyJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ describe('minifyJs', () => {
);
});

it('should minify ES6 inside <script>', () => {
return init(
`<script>
const f = 5 + 10;
let a = (b) => { return b * 5; };
</script>`,
'<script>const f=15;let a=t=>5*t;</script>',
options,
);
});

it('should minify JS inside on* attributes', () => {
return init(
'<a href="#" onclick="return function () {};">click</a>',
Expand Down

0 comments on commit 4c273dd

Please sign in to comment.