【发布时间】:2014-02-09 09:55:03
【问题描述】:
我刚开始在编码过程中使用 Autoprefixer。我正在使用 grunt-autoprefixer。 https://github.com/nDmitry/grunt-autoprefixer
在我的 gruntfile.js 中
sass: {
dist: {
options: {
sourcemap: true
},
files:{
'css/style.css': 'sass/style.scss'
}
}
},
autoprefixer: {
dist: {
options: {
map: true
},
files:{
'build/style.css': 'css/style.css'
}
}
},
源映射被生成。但是,当我在 Chrome 中查看时,它仍然显示 .css 而不是 .scss?
这里是源图。 https://drive.google.com/folderview?id=0B-PvLw2M9kBZZmRkMk9tekh6QWc&usp=sharing
【问题讨论】:
-
请显示您的源地图(两者)。
-
这里是源图。谢谢。您应该可以访问它。 drive.google.com/…
-
@IlanFrumer Yeap。它不是。但 Dimitry 指出源图对于他进行故障排除是必要的。他是 grunt-autoprefixer 的创造者,所以他会知道怎么做。
-
地图看起来不错,路径是正确的。在
build/style.css的底部应该是注释/*# sourceMappingURL=style.css.map */。如果有提供静态文件的服务器,请确保它也提供build目录。还要检查您的浏览器是否支持源映射并启用该功能:developer.mozilla.org/en-US/docs/Tools/… 或 (Chrome) 开发工具 -> 设置 -> 启用源映射 -
@DmitryNikitenko 感谢您的帮助。 build/style.css 的底部确实是 /*# sourceMappingURL=style.css.map */ 我的文件真的很简单。只是 HTML + CSS。我正在做一个小的 CSS 实验。我的浏览器支持 source map 并且该功能已开启。如果在我的 HTML 文件中,我将 build/style.css 更改为 css/style.css,我将获得源映射(我会看到 .scss),它使用的是 SASS 的源映射。所以不知道为什么 Autoprefixer 的 sourcemap 不能工作。
标签: sass gruntjs source-maps