uglifier 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/README.md +34 -6
- data/lib/uglifier/version.rb +1 -1
- data/lib/uglify-harmony.js +2 -2
- data/lib/uglify.js +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dc044eea517b7b84d21ca5004ce75abb6270fa969cf12dfc67355a224998a760
|
4
|
+
data.tar.gz: ef31af6a5dfefa266d5a9222021639901054f7e5c80816ad6ff114b226edb780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582c05aa0420c15e279d07f97d325b3c906964cfd8f8f002d1411620bce7e72a7f1359ed66621f99de2d2a6f8193d1f76e6de527796fe8edc014a38e19cf4977
|
7
|
+
data.tar.gz: 27e035538c9e6030e7137a3fae324cccb0ffeb34b08d2fdd94a96cd15414e56f471b4c7c4d0c822942ebe772b4b23f371e97c0970adb3ecd0a4358d4958fc763
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -3,16 +3,44 @@
|
|
3
3
|
Ruby wrapper for [UglifyJS](https://github.com/mishoo/UglifyJS2) JavaScript
|
4
4
|
compressor.
|
5
5
|
|
6
|
-
UglifyJS currently is
|
7
|
-
ES6/Harmony support can be enabled with `:harmony => true` option.
|
8
|
-
See [UglifyJS2#448](https://github.com/mishoo/UglifyJS2/issues/448) for more
|
9
|
-
details.
|
6
|
+
UglifyJS currently is extensively tested with ES5, but also includes experimental ES6/ES2015+/Harmony support.
|
10
7
|
|
11
|
-
|
12
|
-
recommended. For directly minifying ES6 code, [Closure Compiler](https://github.com/documentcloud/closure-compiler) is a more suitable option.
|
8
|
+
More stable alternatives for working with ES6 code is to first transpile to ES5 with e.g. [babel-transpiler](https://github.com/babel/ruby-babel-transpiler) or using [Closure Compiler](https://github.com/documentcloud/closure-compiler) to directly minify ES6 code.
|
13
9
|
|
14
10
|
[](https://travis-ci.org/lautis/uglifier)
|
15
11
|
|
12
|
+
## ES6 / ES2015+ / Harmony mode
|
13
|
+
|
14
|
+
When using Uglifier with ES6 syntax without any options, an error will be
|
15
|
+
thrown.
|
16
|
+
|
17
|
+
```
|
18
|
+
Uglifier::Error: Unexpected token: punc ((). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
|
19
|
+
```
|
20
|
+
|
21
|
+
The experimental ES6 syntax support can be enabled by passing `:harmony => true`
|
22
|
+
option to Uglifier.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
Uglifier.compile(js, harmony: true)
|
26
|
+
```
|
27
|
+
|
28
|
+
### Rails
|
29
|
+
|
30
|
+
When used in Rails, replace
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
config.assets.js_compressor = :uglifier
|
34
|
+
```
|
35
|
+
|
36
|
+
with
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
config.assets.js_compressor = Uglifier.new(harmony: true)
|
40
|
+
```
|
41
|
+
|
42
|
+
in `config/environments/production.rb`.
|
43
|
+
|
16
44
|
## Installation
|
17
45
|
|
18
46
|
Uglifier is available as a ruby gem.
|
data/lib/uglifier/version.rb
CHANGED