-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Assetic/uglifyjs cookbook article #2406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
.. code-block:: bash | ||
|
||
$ npm install uglifyjs /path/to/symfony/app/Resources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful. This will install uglifyJs 2 by default while you use the filter for uglifyJs 1 later (there is 2 different filters in Assetic as the version 2 is not BC with the version 1)
.. tip:: | ||
|
||
This cookbook uses UglifyJs 1 instead of the newer version 2 to be compatible | ||
with old assetic versions. If you wantt to use UglifyJs version 2, make sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sgoettschkes There is a small typo with 'wantt'
@Sgoettschkes @wouterj How about mentioning UglifyCSS as well? By the way, for me the install command was not working. I am getting errors with |
single: Assetic; UglifyJs | ||
|
||
How to Minify JavaScripts with UglifyJs | ||
======================================= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename this entry so that it's more like an example of using a minification filter, where we use ugllifyjs
as an example:
How to Minify CSS/JS Files (using UglifyJs and UglifyCss)
Then we can make some slight changes to make this entry a bit more general:
- An intro paragraph that talks about how you can use different filters to minify CSS and JS files. We could mention the other filters available to do this: yui css, yui js (both deprecated), Closure, cssmin, jsmin, jsminplus.
- Add a section about using UglifyCss. But here, we can skip most of the details - i.e. we don't need to really show detailed install, since we've shown for UglifyJS. We can also have a shorter configuration section.
- Tweak the "Disable Minification in Debug Mode" section to use UglifyJs as an example, but talk more generally about how this can be used on any filter.
@Sgoettschkes I've just added a few comments! After that, I'll try the code out for myself and merge this. Very nice entry and important for us to get this up there in place of YUI! Thanks! |
@weaverryan Thanks for your input. Regarding your first bulletpoint (intro paragraph): Isn't that covered by http://symfony.com/doc/current/cookbook/assetic/asset_management.html? |
@weaverryan Bullet point two is clear, but I don't know how to make the "Disable Minification in Debug Mode" section more general (bullet point three). Beside the configuration example, it is pretty general. |
Thanks to this documentation, I now know how to use Uglify to inify my assets instead of YUI compressor :) . |
Thanks for testing! I am currently waiting for feedback/improvement suggestions. From my point of view this is ready to be merged! |
* Updating some language * Adding additional clarification details * Updating to use UglifyJS version 2, since this is merged into Symfony 2.2, which uses an AsseticBundle that supports this Uglify version
Hi guys! I've just patched this into the 2.2 branch at the following shas: The good news about the delay in merging this is that 2.1 has reached its end of maintenance, so I merged this into the 2.2 branch, which does support UglifyJS version 2. I updated the entry to reflect that and made other changes at sha: 28f4ae7. I also fixed the local installation. I prefer to use a As always, if anyone notices any mistakes I've made, please let me know! And thanks very much to Sebastian for putting the work together for this entry! Cheers! |
I personally don't like the package.json, simple because this project is not a Node project and uglifyjs is "just a tool". But I don't think it makes a huge difference. Thanks for imprving the article and updating it to 2.2 and UglifyJs 2! |
Will this be also available in 2.4 and master branches? |
This PR involves a new cookbook describing how to use uglifyjs with assetics.
Right now, I copied the yuicomposer cookbook and changed it tto uglifyjs where needed. Please suggest further changes to improve this cookbook.
Pleae also have a look at how the installation of ugliffyjs is done and if this fits "our" view of how it should be installed.