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.
After a deploy I like to run
to get rid of the compiled/compressed assets in
public/assets. This let’s Rails look back to myapp/assetsdirectory in development mode since none of my assets are inpublic/assetsanymore.Also, unless your circumstances are special, you should be putting your images into
app/assets/images, notpublic/system.rake assets:precompilepushes images intopublic/assetstoo. When doing this, you need to useimage_path(...)within your___.css.scssfile(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.