Skip to content
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

assets.compress could be documented better #18057

Closed
ashanbrown opened this issue Dec 16, 2014 · 4 comments
Closed

assets.compress could be documented better #18057

ashanbrown opened this issue Dec 16, 2014 · 4 comments

Comments

@ashanbrown
Copy link
Contributor

I think there are some places in the docs where it still gives the impression that the config.compress flag does something. I also don't think it's completely clear that nil is a legitimate option to pass to js_compressor, and that is is in fact the default for everything but prod. Not only is it legitimate, but it is a really good idea in development which is presumably why it is the default. The strange thing is that if you you set config.assets.debug = true, it will look like your javascript has not been compressed (because all assets are fetched with the body=1 query param), but in fact, sprockets will still have gone and uglified your entire application.js file in the process of checking for errors. Add therubyracer, which appears to slow down execjs by a factor of 3 (at least on my box) and reload times for an ember app become ridiculous. Having spent a few hours figuring this all out, it would be great if other's who have upgraded to rails4 wouldn't have to experience to this. Perhaps the upgrade guide should make it clear that you should really set assets.js_compressor = nil in development.

Here are the doc issues:

From upgrading_ruby_on_rails.md (https://github.com/rails/rails/blob/master/guides/source/upgrading_ruby_on_rails.md#sprockets-rails)

sprockets-rails

  • assets:precompile:primary and assets:precompile:all have been removed. Use assets:precompile instead.
  • The config.assets.compress option should be changed to config.assets.js_compressor like so for instance:
config.assets.js_compressor = :uglifier

configuring.md, still reads:

  • config.assets.compress a flag that enables the compression of compiled assets. It is explicitly set to true in config/environments/production.rb.

In asset_pipeline.md, it still says:

Manifest Files and Directives

Sprockets uses manifest files to determine which assets to include and serve.
These manifest files contain directives - instructions that tell Sprockets
which files to require in order to build a single CSS or JavaScript file. With
these directives, Sprockets loads the files specified, processes them if
necessary, concatenates them into one single file and then compresses them (if
Rails.application.config.assets.compress is true).

@ashanbrown ashanbrown changed the title assets.compress not correctly documented assets.compress could be documented better Dec 16, 2014
@ashanbrown
Copy link
Contributor Author

I would offer a pull request but I imagine it would be rewritten. I also want to point out that this statement in configuring.md also isn't quite true:

  • config.assets.debug disables the concatenation and compression of assets. Set to true by default in development.rb.

In fact, if you set assets.debug = true and js_compressor = :yui, the javascript compression still happens, you just don't see it because all of your assets were fetched with ?body=1. So this is more than just a documentation issue.

@BrianTheCoder
Copy link

In 4.2 setting config.assets.js_compressor = nil or config.assets.compress = false is still compressing my assets in production :(

@rails-bot
Copy link

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Rails team are limited, and so we are asking for your help.

If you can still reproduce this error on the 4-2-stable, 4-1-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

@rails-bot
Copy link

This issue has been automatically closed because of inactivity.

If you can still reproduce this error on the 4-2-stable, 4-1-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants