46

I was compiling my asset pipeline for my production environment and it did for all my environments. How can I uncompile my asset pipeline for my development environment?

I have checked my config/development environment and cannot find a fix.

Thanks in advance for any help...

Kyle C
  • 4,077
  • 2
  • 31
  • 34

4 Answers4

90

To remove precompiled assets use:

rake assets:clean

What this basically does is remove the public/assets directory. You may need to include the RAILS_ENV variable if you need to run it for a certain environment.

Phil Bottomley
  • 2,387
  • 1
  • 17
  • 20
45

Try using

rake assets:clobber

worked for me in rails 4

mattecalcio
  • 491
  • 4
  • 4
  • Care to explain why this works? Until then I cannot vote up your answer and frankly few people will, SO answers should help people understand the issue not just provide a line of code. – jasonleonhard Mar 02 '17 at 00:59
  • It deletes compiled assets. You can also manually remove them, this is just a shortcut. – mattecalcio Feb 11 '18 at 02:28
5

For Rails 5:

$ RAILS_ENV=development bin/rake assets:clobber
stujo
  • 2,089
  • 24
  • 29
5

When you run the compile task locally (on your development machine) the assets are compiled in the Rails production environment, but are written to the public folder.

This means that even when you run in development mode it'll use the compiled assets instead of sending requests to the pipeline. This is normal behavor - requests only go to the pipeline if the file does not exists in public/assets.

The compile task should generally only be used when deploying, and on the remote (production) machine.

If you have compiled locally, you can delete all the files in the public/assets folder and development will behave as before. If you checked these files into source control you'll need to remove them.

Once removed things should work fine. s One final tip: if this is an upgraded app check your config settings against those in the last section of the Rails asset pipeline guide.

Richard Hulse
  • 10,383
  • 2
  • 33
  • 37