【问题标题】:Sass Disable Source MapsSass 禁用源映射
【发布时间】:2014-09-17 18:32:03
【问题描述】:

新的 Sass (3.3+) 有没有办法默认禁用源映射?现在,当我查看检查员时,我不断收到main.css.map(403 禁止)。看起来它是默认生成的,但我想禁用它。

有什么想法吗?

【问题讨论】:

  • 你正在通过控制台使用 sass? sass --watch... 或任何类似 Grunt、Gulp 的工具?
  • 我正在使用带有 grunt-contrib-compass 的 Grunt。
  • 您是否尝试在您的 Gruntfile 中添加 sourcemap: false?在指南针配置的选项值中。

标签: sass


【解决方案1】:

grunt-contrib-sass 模块接受 'options' 中名为 'sourcemap' 的属性。

grunt.initConfig({
  sass: {
    dist: {
      files: {
        'main.css': 'main.scss'
      },
      options: {
        'sourcemap': 'none'
      }
    }
  }
});

Documentation

将值设置为“none”应该会阻止创建源映射。

【讨论】:

    【解决方案2】:

    'sourcemap': 'none' 选项将不再有效,因为它适用于不再受支持的 Ruby SASS。

    请改用以下方式之一:

    options: {
        'no-source-map': ''
    }
    

    options: {
        sourceMap: false
    }
    

    【讨论】:

      猜你喜欢
      • 2013-06-21
      • 2014-10-19
      • 2016-05-24
      • 1970-01-01
      • 2014-04-30
      • 2015-01-09
      • 1970-01-01
      • 2018-12-01
      • 1970-01-01
      相关资源
      最近更新 更多