如何在没有文件或行引用的情况下运行罗盘编译?

时间:2012-10-26 04:19:13

标签: ruby-on-rails sass compass-sass compass

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

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

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

3 个答案:

答案 0 :(得分:11)

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

line_comments = false

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

答案 1 :(得分:0)

只是为了更新以前的答案,由Chase T。

对我来说这不再适用了。

line_comments = false

应该成为

line_comments = 0

答案 2 :(得分: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