【问题标题】:Autoprefixer: Sourcemap is generated but it isn't working?Autoprefixer:Sourcemap 已生成但无法正常工作?
【发布时间】: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


【解决方案1】:

我已确定问题出在 Google 云端硬盘。 我将所有代码都托管在 Google Drive 上,并直接在上面进行编码。

存在一些缓存和同步问题。 所以在设置方面,一切都是正确的。

【讨论】:

    猜你喜欢
    • 2021-03-29
    • 2010-12-30
    • 2017-03-15
    • 2011-12-18
    • 2017-10-05
    • 2015-02-05
    • 2011-06-16
    • 2013-05-21
    • 2015-03-26
    相关资源
    最近更新 更多