使用compass sprite的时候怎么让它不再次生成文件名

2013-12-31 10:14:40 +08:00
 coolicer
我在config.rb贴上这个也不行。

# Make a copy of sprites with a name that has no uniqueness of the hash.
on_sprite_saved do |filename|
if File.exists?(filename)
FileUtils.cp filename, filename.gsub(%r{-s[a-z0-9]{10}\.png$}, '.png')
end
end

# Replace in stylesheets generated references to sprites
# by their counterparts without the hash uniqueness.
on_stylesheet_saved do |filename|
if File.exists?(filename)
css = File.read filename
File.open(filename, 'w+') do |f|
f << css.gsub(%r{-s[a-z0-9]{10}\.png}, '.png')
end
end
end
2073 次点击
所在节点    程序员
2 条回复
fen
2013-12-31 10:32:39 +08:00
这是 compass 的特性,要到下个版本才有可能改善。
这两段代码只是复制了一张没有hash名的图片并修改css代码,他生成的带hash名 png 图片不要删除,否则会继续重新生成。
coolicer
2013-12-31 13:47:12 +08:00
@fen 好。我以为是错的,没看清楚。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/95137

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX