0

I recently deployed a first iteration of a project to Heroku. Because I precompiled, all of my assets used during development are now in the public/assets and public/system folders.

I am aware of two options for accessing my assets during development. The default option seems to be to allow the public/assets files to override my app/assets files. However, if I do this, any CSS changes I make in app/assets is not reflected.

The alternative option is to access ONLY the app/assets folder through:

config.serve_static_assets = false

However, by doing this, I can't see any of my images during development, as they have already been precompiled and moved to public/system

Is there a way to access my CSS/JS files from app/assets, yet still load my images from public/system?

Or am I supposed to do all of my CSS/JS development out of the public/assets folder? Any feedback would be much appreciated.

Community
  • 1
  • 1
umezo
  • 1,519
  • 1
  • 19
  • 33

1 Answers1

0

After a deploy I like to run

rake assets:clean

to get rid of the compiled/compressed assets in public/assets. This let's Rails look back to my app/assets directory in development mode since none of my assets are in public/assets anymore.

Also, unless your circumstances are special, you should be putting your images into app/assets/images, not public/system. rake assets:precompile pushes images into public/assets too. When doing this, you need to use image_path(...) within your ___.css.scss file(s) to allow the paths to be updated properly with the hashed filename generated for the image assets during precompile.

Finally, it seems reading through this Rails Guide would do you a lot of good.

deefour
  • 34,974
  • 7
  • 97
  • 90
  • Hi @Deefour, thanks for the feedback. That sounds about right. Let me see if I can fix my images path, and I'll give it a try. Do you have a path/url specified in the has_attached_file line of your model? – umezo Jul 30 '12 at 19:53
  • `has_attached_file`? I have no idea what you're referring to, sorry. – deefour Jul 30 '12 at 23:20
  • Hi @Deefour, thanks again for your help. rake assets:clean worked perfectly afterall. The issue was, I'm using Paperclip, and my uploaded images get saved to public/system during development. However, this is fine, as it doesn't have to be precompiled for production, and it doesn't get removed by rake assets:clean. – umezo Jul 31 '12 at 03:14