Skip to content

Should propshaft always return the latest compiled assets in development? #250

@yokonao

Description

@yokonao

Hello! I'm a developer who loves using Propshaft. I find it simple and really like it.
I have a question about its behavior.

I've already read through the discussion at #97.

In development environments, Propshaft is expected to compile and return asset files at request time. This ensures that frequently updated asset files in development are always served in their latest state.

However, there seems to be an exception to this behavior. As mentioned in the warning when running the assets:precompile task, once assets:precompile is executed, Propshaft switches to returning compiled assets, and subsequent on-demand compilation at request time no longer occurs.

I believe this behavior differs from Rails users' expectations. In fact, other developers have had the same concern: #97

Is it intentional design that assets are not compiled in certain situations even in development environments? I think it would be preferable to always return the latest compiled assets. As an alternative, an explicit option to opt-in to static asset serving in development environments would be good.

Note

If we want to always return the latest assets in development, two modifications would be needed:

  • The resolver decision logic in Propshaft::Assembly.
  • Implementing Propshaft::Server as Rack Middleware to run before ActionDispatch::Static.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions