【发布时间】:2016-08-02 21:08:42
【问题描述】:
在查看documentation for render_with_sourcemap 之后(不幸的是找不到任何使用示例),我的印象是以下应该可以工作:
@source_dir = './sass/'
@target_dir = './css/'
@output = Sass::Engine.new(File.read(@source_dir + 'style.scss'), {
cache_location: @source_dir + '.sass-cache',
style: :compressed,
syntax: :scss
}).render_with_sourcemap(@target_dir + 'style.css.map')
但是,我得到的错误是:
Error generating source map: couldn't determine public URL for the source stylesheet. (Sass::SyntaxError)
No filename is available so there's nothing for the source map to link to.
它的工作原理是简单地使用 render(不需要参数)而不是 render_with_sourcemap,所以我相信我的文件名是错误的 - 但是,我看不出我做错了什么。我也试过/style.css.map、./style.css.map和@target_dir + style.css.map,都没有成功(得到同样的错误)
【问题讨论】: