Skip to content

Assets added to config.assets.precompile are being ignored in Rails 4.0.0.beta1 #9572

@murdoch

Description

@murdoch

On Rails 3 I got into the habit of keeping a separate admin stylesheet (app/assets/stylesheets/admin.css), incorporating bootstrap/foundation and then in production.rb I'd have something like:

# in config/production.erb
config.assets.precompile += ( admin.css )

I could then run:

RAILS_ENV=production bundle exec rake assets:precompile

And this would generate admin.css and admin.css.gz.

But this seems to be broken in Rails 4.0.0.beta1. It might be a sprockets issue, so pardon me if that's the case.

Now, no matter what I put in my admin.css file, and no matter what I add to production.rb
the admin stylesheet is never precompiled.

Rails 4 example app
Rails 3 example app

Steps to reproduce:

  1. Clone sample apps bundle install
    NB: sample apps were used to report another issue, so there is a bit of left-over detritus in there, just ignore it
  2. Starting with the Rails 4 example app, run:
    RAILS_ENV=production bundle exec rake assets:precompile
  3. Inspect public/assets
  4. Observe that the admin stylesheet has not been precompiled
  5. Repeat steps 2 and 3 using Rails 3 sample app
  6. Observe that admin stylesheet has been precompiled

For now I'm getting round this by lobbing everything into my application.css

This happens with js assets too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions