问题出在 bootstrap sass ,图标精灵路径是所有方式的前缀' ../'在图像之前,
' ../../图像/../图像/ glyphicons-半身-white.png'
我希望像这样' ../ images /../ images / glyphicons-halflings-white.png'
grunt files config:
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
imagesDir: 'images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: '<%= yeoman.app %>/components',
relativeAssets: true
},
如何配置grunt文件以删除前缀。
答案 0 :(得分:2)
以下是Compass任务的默认配置:https://github.com/yeoman/generator-webapp/blob/master/app/templates/Gruntfile.js#L157
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: '<%= yeoman.app %>/bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
debugInfo: true
}
}
}
也许尝试与此同步并查看它是否自行排除。
答案 1 :(得分:0)
Yeoman, Grunt and Compass sprites为我工作:
// The next line tells compass where to put the sprites
// and the HTTP path to them.
raw: 'http_images_path = "/images/"\ngenerated_images_dir = ".tmp/images"\nhttp_generated_images_path = "/images/"',
// This doesn't work with relative paths.
relativeAssets: false