24

Is there a way to force regeneration of assets every request when using the Rails 3.1 Asset Pipeline?

I am having problems getting the system to pick up changes to files when using Less (less-rails) with a series of partials and mixin files. If I could just force the system to generation on each request I would be much more productive.

Toby Hede
  • 36,755
  • 28
  • 133
  • 162

4 Answers4

47

To force a complete regeneration of all assets use:

rake assets:clobber assets:precompile

Very handy when asset_sync isn't playing fair with you...

I know this may not help you, but hopefully it will make it easier for someone else to find the answer.

FuzzyJulz
  • 2,714
  • 1
  • 16
  • 18
20

You can reset the assets cache with

rake tmp:cache:clear
Mike Lyons
  • 1,748
  • 2
  • 20
  • 33
2

You have to run your server in the development environment. I think you can also use something like config.cache_classes = false in your current environment's config file.

Cydonia7
  • 3,744
  • 2
  • 23
  • 32
2

I worked it out.

The master.less file (as in the main less file that coordinates the other include files) needed to have the pipeline directives added to it.

So in my case, application.css contains:

/*
 *= require html5reset-1.6.1
 *= require master
*/

And master.css.less contains:

/*
 *= depend_on mixins
*/
@import "mixins";
Toby Hede
  • 36,755
  • 28
  • 133
  • 162