Я использую Sencha Touch 2 и нашел следующее расширение sass для этого:
theme_images.rb:
module SenchaTouch
module SassExtensions
module Functions
module ThemeImages
def theme_image(theme, path, mime_type = nil)
path = path.value
images_path = File.join(File.dirname(__FILE__), "..", "images", theme.value)
real_path = File.join(images_path, path)
inline_image_string(data(real_path), compute_mime_type(path, mime_type))
end
end
end
end
end
module Sass::Script::Functions
include SenchaTouch::SassExtensions::Functions::ThemeImages
end
compass_init.rb:
# This file registers the sencha-touch framework with compass
# It's a magic name that compass knows how to find.
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'theme_images.rb')
Compass::Frameworks.register 'sencha-touch', dir
См. Употребления:
background: theme_image($theme-name, "clear_icon.png") no-repeat;
-webkit-mask: theme_image($theme-name, "select_mask.png");
-webkit-mask-image: theme_image($theme-name, "pictos/arrow_down.png");