22 single: Assetic; UglifyJs
33
44How to Minify JavaScripts with UglifyJs
5- =============================================================
5+ =======================================
66
77`UglifyJs `_ is a javascript parser/compressor/beautifier toolkit. It can be used
88to combine and minify javascript assets so they need less HTTP requests and makes
99the website load faster.
1010
1111Install UglifyJs
12- -------------------------------
12+ ----------------
1313
14- UglifyJs is build as an node.js npm module and can be installed using npm. First, you
15- need to `install node.js `_. Afterwards you can install UglifyJs using npm:
14+ UglifyJs is build as an node.js npm module and can be installed using npm. First,
15+ you need to `install node.js `_. Afterwards you can install UglifyJs using npm:
1616
1717..code-block ::bash
1818
@@ -25,13 +25,13 @@ need to `install node.js`_. Afterwards you can install UglifyJs using npm:
2525
2626 ..code-block ::bash
2727
28- $ npm install uglifyjs /path/to/symfony/app
28+ $ npm install uglifyjs /path/to/symfony/app/Resources
2929
30- It is recommended that you installuglifyjs in yourapp folder and add the `` node_modules ``
31- folder to version control.
30+ It is recommended that you installUglifyJs in your`` app/Resources `` folder
31+ and add the `` node_modules `` folder to version control.
3232
3333Configure the UglifyJs Filter
34- -------------------------
34+ -----------------------------
3535
3636Now we need to configure symfony2 to use the UglifyJs Filter when processing your
3737stylesheets:
@@ -68,18 +68,18 @@ stylesheets:
6868
6969 ..note ::
7070
71- The path whereuglifyjs is installed may vary depending on your system.
72- To find out where npm stores the bin folder, you can use the following
71+ The path whereUglifyJs is installed may vary depending on your system.
72+ To find out where npm stores the`` bin `` folder, you can use the following
7373 command:
7474
7575 ..code-block ::bash
7676
7777 $ npm bin -g
7878
7979 It should output a folder on your system, inside which you should find
80- theuglifyjs executable.
80+ theUglifyJs executable.
8181
82- If you installeduglifyjs locally, you can find the bin folder inside
82+ If you installedUglifyJs locally, you can find the bin folder inside
8383 the ``node_modules `` folder. It's called ``.bin `` in this case.
8484
8585You now have access to the ``uglifyjs `` Filter in your application.
@@ -149,7 +149,7 @@ apply this filter when debug mode is off.
149149 Instead of adding the filter to the asset tags, you can also globally
150150 enable it by adding the apply-to attribute to the filter configuration, for
151151 example in the ``uglifyjs `` filter ``apply_to: "\.js$" ``. To only have the filter
152- applied in production, add this to the config_prod file rather than the
152+ applied in production, add this to the`` config_prod `` file rather than the
153153 common config file. For details on applying filters by file extension,
154154 see:ref: `cookbook-assetic-apply-to `.
155155