我在我的项目中使用Compass inline-image helper但是它似乎确实创建了一个数据uri,它也正在添加一个开始结果的路径。
我也没有来自compass watch
的错误。
这是SCSS:
.myelement {
display: block;
float: right;
height: 42px;
text-indent: -10000px;
width: 29px;
background-image: inline-image('myimage.gif');
}
这是编译的CSS:
.myelement {
background-image: url("http://myproject/foo/bar/css/data:image/gif;base64,R0lGODlhDgDVAOZIAN7d3PDICPz7+eLh4O7t6/333ODf3f/+/P79+/f29Pn49/X08+no5+rp5/HLFPXcYvLOJffjgubl5PTWSPvwvPb18/788N/e3fj39fjmkfXbXPbdaPruse3s6+zr6ffhdvDJDubl4+vq6Prus/Tz8fPy8Ozr6vv6+OTj4f777vvxv/HMGfTVQvLPKPbea/zzyPXZVPDv7fnpnPfgdPfifPzzy+jn5fDJC+rp6Pz10fz0zvHKEfPSNPHw7/355fvxwuDf3uTj4vTz8vPTOfXbX/rsqPr59/343////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAEgALAAAAAAOANUAAAfygEiCgz0Kg4eHAkAMiI0dAAAJjYMnF5AhiEYkBDYDkJAoDTEVAgSfp6cGkh6opxcVgw2tkEKHCJ6oJo0GrTiIArMSiBiQDBglQQADiAsihoMLEgiT1NXW19jZ2tvc3d7f4OHi4+Tl5ufo6err7O3u7/Dx8vP09fb3+Pn6+/z9/v8AAwocSLCgwYMIEypcyLChw4cQI0qcSPGbjALXLKzQcI1GgAAvqvkA8ZEFoiMcIsCA8PEjjwcZfliI0LJmTQc1kMywWXOHikEPeAa4MeLQAZY2PzRywHMDohRCJyDK8ZGIjiJDArRARMEFxkEUJhwQFAgAOw==");
display: block;
float: right;
height: 42px;
text-indent: -10000px;
width: 29px;
}
正如您所看到的,正在生成数据uri但添加http://myproject/foo/bar/css/
会使网址无效。
我的config.rb:
require "zurb-foundation"
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
感谢任何帮助。