6

如何在运行时抑制文件或行引用,例如下面的注释输出行,compass compile并可能--output-style在默认情况下保持扩展?

/* line 85, ../../../app/stylesheets/simpla/style.sass */
.align-right { 
  float: right;
}

问题是每当我在 sass 中进行 1 行更改时,它都会对我的 css 进行 50 多行更改以更新所有已调整的参考行号。这使得阅读我的 git 提交中的实际更改变得非常困难。

4

3 回答 3

11

没关系,刚刚想通了。在 config/compass.rb 中,设置:

line_comments = false

这将抑制/删除已编译 css 文件中的注释。

于 2012-10-26T05:07:08.837 回答
0

只是为了更新之前的答案,由 Chase T.

对我来说,这不再起作用了。

line_comments = false

应该成为

line_comments = 0
于 2013-10-29T10:14:55.003 回答
0

从命令行,尝试:

compass compile --no-line-comments

如果您使用 Grunt 和grunt-contrib-compass,它是noLineComments: true,例如

module.exports = function (grunt) {
    grunt.initConfig({
        watch: {
            src: {
                files: ['**/*.scss', '**/*.php'],
                tasks: ['compass:dev']
            },
            options: {
                livereload: true
            }
        },
        compass: {
            dev: {
                options: {
                    sassDir: 'sass',
                    cssDir: 'css',
                    imagesPath: 'img',
                    noLineComments: true,
                    outputStyle: 'compressed'
                }
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
};

然后运行:grunt compass

于 2015-12-17T13:45:50.980 回答