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

Precompiling on page load in development #419

Open
neyp opened this issue Jan 9, 2018 · 1 comment
Open

Precompiling on page load in development #419

neyp opened this issue Jan 9, 2018 · 1 comment

Comments

@neyp
Copy link

neyp commented Jan 9, 2018

I'm using Rails 5.1.4, sprockets 3.7.1 and sprockets-rails 3.2.1. When I start the development server and visit a url for the first time, precompiling is triggered hugely slowing down page load. This wasn't happening with Rails 4 and an older version of Sprockets.

@onyxblade
Copy link

onyxblade commented Feb 27, 2018

Caused by https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb#L34-L52. The asset_precompiled? is called under development environment and the precompiled_assets is the time consuming one.

Since sprockets v3, there is a raise_unless_precompiled_asset call for each asset_path call to check if the asset precompiled. Sprockets-rails v2 does not perform such checks.

https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/rails/helper.rb#L78 this line controls to skip the asset_precompiled? check. However the options[:debug] is not presented true under development environment and seems useless. Setting it true will avoid the precompiling.

I am wondering if the debug option should be passed true for development environment?

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

No branches or pull requests

2 participants