Closed chrisGoad closed 8 years ago
The thing is minify
uses uglify for js minification.
Unfortunately uglify
doesn't support minification of es6 yes and I do not know any uglifiers with similar functionality and es-support.
Anyway you can use babel for this purpose. This is how:
coderaiser@cloudcmd:~$ cat > hello.js
const hello = 'world';
console.log(`${hello}`);
if (false) { console.log(hello);}
^C
coderaiser@cloudcmd:~$ babel --preset es2015 hello.js | minify --js
"use strict";var hello="world";console.log(""+hello);
Is it works for you?
Hmm this was working from OUJS perspective a little while back. Is this repo using the harmony branch?
What is OUJS
? This repo uses uglify from npm.
Thank you for your response. My use of template literals was very minimal, and the easiest thing for me to do has been to dispense with them. Do think uglify might evolve towards complete es6 support? Maybe I'll monitor that.
--Chris
On Mon, Aug 8, 2016 at 1:29 AM, coderaiser notifications@github.com wrote:
The thing is minify uses uglify https://github.com/mishoo/UglifyJS2 for js minification. Unfortunately uglify doesn't support minification of es6 yes https://github.com/mishoo/UglifyJS2/issues/448 and I do not know any uglifiers with similar functionality and es-support.
Anyway you can use babel https://babeljs.io/ for this purpose. This is how:
coderaiser@cloudcmd:~$ cat > hello.js const hello = 'world'; console.log(
${hello}
);if (false) { console.log(hello);} ^Ccoderaiser@cloudcmd:~$ babel --preset es2015 hello.js | minify --js"use strict";var hello="world";console.log(""+hello);
Is it works for you?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/coderaiser/minify/issues/36#issuecomment-238161082, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3QRpexLB3ziHdFiRdLUgeRVBvSOpU8ks5qdtrSgaJpZM4Jd6MU .
I think it definitely will. It event has harmony branch and I think they will merge it to master someday.
@coderaiser
harmony branch and of course you may already know the issue thread.
This repo uses uglify from npm.
That would probably be why your template string literals are failing is because you are using the ES5 master which is published to npmjs.com and not the harmony branch... just thought I'd give a welcome hand.
@martii I don't think that using code under active development that has no version is a good idea. I think they will merge some day (I hope it will be soon :)).
@coderaiser
I think they will merge some day (I hope it will be soon :)).
Us too but our project/repo/production is currently listing it as experimental and there is strong interest. :)
Emits an error with message: Unexpected error character `