-
Notifications
You must be signed in to change notification settings - Fork 247
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 are compiled every time app starts #352
Comments
Correct. It is a know and desired behavior. It is compiled to check if all your assets used in assets helpers are in the precompile list. There is an option to opt out this behavior at the master branch if you want to disable this check. |
Yes. It is good it can be disabled because for me first request takes about 70 seconds. |
Option sprockets-rails/lib/sprockets/rails/helper.rb Line 346 in b4f9006
|
Yes, it does. The compilation is made when the |
You have to set that option to false to disable it. If it is not working in your application maybe it is being compiled somewhere else. |
I made a mistake when set |
I would recommend adding something to the Rails upgrade guide regarding this - given the number of apps with significant asset compile times in the wild this could surprise a lot of people. In our case, it caused significant test speed regressions in our parallel tests, as sixteen threads all tried to compile 50s worth of assets at the same time. |
While I like this behavior, it should definitely be mentioned in the upgrade guide. |
We were bitten by this as well. I agree – a mention in the upgrade guide, or possibly outputting that it happens in the server output (e.g. "Checked precompiled assets (took 1234 seconds)") so it's easier to determine what's going on. @rafaelfranca, would you be open to a PR with one or both of the above? I guess upgrade guide might be good if you don't want to release a new 4.2.x for this (we saw it on an upgrade to 4.2). Though if this issue also exists in master, maybe we could do the other thing too. |
It doesn't fit the upgrade guide since you can upgrade rails without upgrading sprockets. This is a configuration in sprockets-rails and it is documented in sprockets-rails and it is in the CHANGELOG of sprockets-rails. Maybe we could improve the sprockets-rails documentation, or maybe explain it in the assets pipeline guide? |
I see your point. I'm not sure we would have found it in any of those places, but that's not to say it wouldn't help someone else. How would you feel about something like "Checked precompiled assets (took 1234 seconds)" in the server output. But perhaps only showing it if takes longer than say 10 seconds, to keep down on noise for everyone else? I think that would have helped us catch it sooner. |
The performance benefits of disabling |
Recently upgraded to sprockets 3.x. App has huge amount of assets - images and stylesheets. They should be loaded only under special conditions. With caching disabled, first request after server boot takes around ~1.5 minutes. I've spent couple of days trying to understand what's going on, until I finally found this answer: https://stackoverflow.com/questions/35683185/rails-sprocketsrailshelperassetnotprecompiled-in-development#51898048 and set config.assets.check_precompiled_asset = false Logging time-consuming operations would definetely have helped and would have saved a lot of time. |
I was getting an exception when loading the styleguide documentation after running `bin/rails s` in development because my assets weren't precompiled, which is expected in development. Changing this configuration I'm not sure when this was introduced (below issue suggests 2016, so may have appeared once we upgraded Rails/Sprockets) or if others are running into it. More: rails/sprockets-rails#352
I was getting an exception when loading the styleguide documentation after running `bin/rails s` in development because my assets weren't precompiled, which is expected in development. Changing this configuration I'm not sure when this was introduced (below issue suggests 2016, so may have appeared once we upgraded Rails/Sprockets) or if others are running into it. More: rails/sprockets-rails#352
After update from sprockets 2.x assets now are compiled every time app starts in development environment. What is exactly compiled? Everything! Application assets and assets from all loaded Rails::Engine.
To reproduce:
Rails 4.2.5
sprockets 3.6.0
sprockets-rails 3.0.4
The text was updated successfully, but these errors were encountered: