【问题标题】:Disable line comments compass not working禁用行注释指南针不起作用
【发布时间】:2014-01-01 02:25:39
【问题描述】:

我正在尝试在我的 compass config.rb 文件中禁用行 cmets,但我仍然不断在我的普通 css 文件中获取对 scss 文件的行引用。

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false

我已重新启动指南针。保存我的 .scss 后删除了我的缓存文件夹和我的 css 文件。我在这里做错了什么?

【问题讨论】:

    标签: sass compass-sass


    【解决方案1】:

    我的 config.rb 文件被忽略了。通过使用命令行进入文件夹并在文件夹中键入 compass watch 来修复它。

    我仍然感到困惑,因为我的 WAMP 文件夹中有其他项目,我只是为这些项目使用 compass watch [project],而这些项目的 config.rb 文件不会被忽略。

    【讨论】:

    • 确保罗盘手表没有运行。如果是这样,请在对 config.rb 文件进行更改后停止并重新启动它
    【解决方案2】:

    即使输出样式“压缩”,我也无法删除多行 cmets,sass/scss 文档也建议不删除它们(仅删除带有“//”的单行 cmets) .

    我的解决方案是在 sass 生成其最终输出后,简单地应用 Perl 单线从 .css 文件中手动删除 cmets:

    sass -fCE utf-8 -t compressed application.sass application.css
    perl -pi -e'BEGIN{$/=undef}s#/\*.*?\*/##gs' application.css
    

    【讨论】:

      【解决方案3】:

      这对我有用

      compass_config do |config|
        config.sass_options = { :line_comments => false }
      end
      

      【讨论】:

      • @cimmanon 什么?这是唯一对我有用的方法……上面的方法都没有。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-03
      • 2012-07-25
      • 2014-08-21
      • 1970-01-01
      • 2011-12-21
      • 2013-10-12
      相关资源
      最近更新 更多