简体   繁体   中英

How do I prevent rails 3.2 from precompiling individual images?

I'm using compass for sprite compilation and I'm wondering how I prevent unused images from getting compiled during rake assets:precompile .

For example in a sass file I have.

@import "my-icons/*.png";
@include all-my-icons-sprites;

After asset precompilation i'm getting the compiled sprite map and all the compiled images:

public/assets/my-icons-{hash}.png
public/assets/my-icons/2-{hash}.png
public/assets/my-icons/3-{hash}.png
public/assets/my-icons/4-{hash}.png
public/assets/my-icons/5-{hash}.png

My question is how do I stop pre-compilation from compiling individual images in my-icons/ and only compiling a single sprite map so that I only end up with public/assets/my-icons-{hash}.png ?

You don't need to. Those images (which are just copies, with a new filename) are not used in your pages so they are not served, they don't consume bandwidth nor memory nor parallel requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM