简体   繁体   English

如何防止Rails 3.2预编译单个图像?

[英]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 . 我正在使用指南针进行Sprite编译,并且想知道如何防止在rake assets:precompile期间编译未使用的图像。

For example in a sass file I have. 例如,在一个sass文件中。

@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 ? 我的问题是,如何停止预编译来编译my-icons/单个图像,而仅编译单个sprite贴图,这样我最终只能看到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. 这些图像(只是副本,具有新的文件名)不会在您的页面中使用,因此不会被提供,它们不会占用带宽,内存或并行请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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