mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
0d8f6575ab
commit
955041b957
2 changed files with 6 additions and 6 deletions
|
@ -1068,20 +1068,20 @@ Possible options for JavaScript compression are `:terser`, `:closure`, `:uglifie
|
||||||
`:yui`. These require the use of the `terser`, `closure-compiler`, `uglifier` or
|
`:yui`. These require the use of the `terser`, `closure-compiler`, `uglifier` or
|
||||||
`yui-compressor` gems, respectively.
|
`yui-compressor` gems, respectively.
|
||||||
|
|
||||||
Take the `uglifier` gem, for example.
|
Take the `terser` gem, for example.
|
||||||
This gem wraps [UglifyJS](https://github.com/mishoo/UglifyJS) (written for
|
This gem wraps [Terser](https://github.com/terser/terser) (written for
|
||||||
NodeJS) in Ruby. It compresses your code by removing white space and comments,
|
NodeJS) in Ruby. It compresses your code by removing white space and comments,
|
||||||
shortening local variable names, and performing other micro-optimizations such
|
shortening local variable names, and performing other micro-optimizations such
|
||||||
as changing `if` and `else` statements to ternary operators where possible.
|
as changing `if` and `else` statements to ternary operators where possible.
|
||||||
|
|
||||||
The following line invokes `uglifier` for JavaScript compression.
|
The following line invokes `terser` for JavaScript compression.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
config.assets.js_compressor = :uglifier
|
config.assets.js_compressor = :terser
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: You will need an [ExecJS](https://github.com/rails/execjs#readme)
|
NOTE: You will need an [ExecJS](https://github.com/rails/execjs#readme)
|
||||||
supported runtime in order to use `uglifier`. If you are using macOS or
|
supported runtime in order to use `terser`. If you are using macOS or
|
||||||
Windows you have a JavaScript runtime installed in your operating system.
|
Windows you have a JavaScript runtime installed in your operating system.
|
||||||
|
|
||||||
### GZipping your assets
|
### GZipping your assets
|
||||||
|
|
|
@ -172,7 +172,7 @@ pipeline is enabled. It is set to `true` by default.
|
||||||
|
|
||||||
* `config.assets.css_compressor` defines the CSS compressor to use. It is set by default by `sass-rails`. The unique alternative value at the moment is `:yui`, which uses the `yui-compressor` gem.
|
* `config.assets.css_compressor` defines the CSS compressor to use. It is set by default by `sass-rails`. The unique alternative value at the moment is `:yui`, which uses the `yui-compressor` gem.
|
||||||
|
|
||||||
* `config.assets.js_compressor` defines the JavaScript compressor to use. Possible values are `:closure`, `:uglifier` and `:yui` which require the use of the `closure-compiler`, `uglifier` or `yui-compressor` gems respectively.
|
* `config.assets.js_compressor` defines the JavaScript compressor to use. Possible values are `:terser`, `:closure`, `:uglifier` and `:yui` which require the use of the `terser`, `closure-compiler`, `uglifier` or `yui-compressor` gems respectively.
|
||||||
|
|
||||||
* `config.assets.gzip` a flag that enables the creation of gzipped version of compiled assets, along with non-gzipped assets. Set to `true` by default.
|
* `config.assets.gzip` a flag that enables the creation of gzipped version of compiled assets, along with non-gzipped assets. Set to `true` by default.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue