Ask A Question

Notifications

You’re not receiving notifications from this thread.

development env: is the asset pipeline expected to compile all assets or just those in demand?

Josh asked in Rails

I'm trying to understand if, in development, the asset pipeline is supposed to compile ALL assets found in manifest.js or just the ones that are requested.

I've been doing some testing and have found that it appears all assets are compiled even when only a singular small asset is requested. This for us can be extremely slow.

It would seem to me that all assets are compiled even if a singular, small, asset is requested. This, for us, is very slow.

Reply

In development, the asset pipeline typically compiles only requested assets and their dependencies. If it's compiling all assets, it could be due to:

Manifest Configuration: Broad directives like require_tree . in manifest.js might load everything.
Dependencies: A requested asset may depend on others, triggering additional compilations.
Configuration Flags: Certain settings might force precompilation.
To fix this:

Simplify manifest.js to include only necessary assets.
Enable debugging (e.g., config.assets.debug = true in Rails) to load assets individually.
Precompile large, infrequently changing assets if needed.
snow rider

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,400+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.