使用 Grunt SASS 使相对背景图像路径成为绝对路径?
Make relative background image paths absolute with Grunt SASS?
我正在使用 Grunt SASS
https://github.com/sindresorhus/grunt-sass
是否可以将我的图像路径转换为绝对路径?所以如果我这样写:
.something {
background: url(../icon.png);
}
我希望编译后的 CSS 为:
.something {
background: url(www.mysite.com/images/icon.png);
}
这可以用 grunt css url 替换来完成:
https://www.npmjs.com/package/grunt-css-url-replace
但这并不理想。 运行 额外的任务会变慢,我预计这会弄乱我的源映射。 grunt sass 的附加/配置设置会更好,但我似乎找不到。
我正在使用 Grunt SASS https://github.com/sindresorhus/grunt-sass
是否可以将我的图像路径转换为绝对路径?所以如果我这样写:
.something {
background: url(../icon.png);
}
我希望编译后的 CSS 为:
.something {
background: url(www.mysite.com/images/icon.png);
}
这可以用 grunt css url 替换来完成: https://www.npmjs.com/package/grunt-css-url-replace
但这并不理想。 运行 额外的任务会变慢,我预计这会弄乱我的源映射。 grunt sass 的附加/配置设置会更好,但我似乎找不到。