1

It is my first time trying out Compass and encountered an issue around how Compass compressed SCSS files.

I had a simple .scss file with the following code:

@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');

.fa-apple, .fa-android, .fa-twitter {
    font-size: 60px;
}

I set up a Gulp task to compile the file and here is the task:

gulp.task('compass', function() {
    gulp.src('app/scss/style.scss')
        .pipe(compass({
            config_file: './config.rb',
            css: 'app/css',
            sass: 'app/scss',
            require: ['susy', 'breakpoint']
        }))
        .pipe(gulp.dest('app/css'));
});

And this is my config.rb:

require 'susy'
require 'breakpoint'

project_type = :stand_alone
http_path = "/"
sass_dir = "app/scss"
css_dir = "app/css"
images_dir = "app/images"
fonts_dir = "app/fonts"
javascript_dir = "app/js"
line_comments = true
preferred_syntax = :scss
output_style = :compressed
relative_assets = true

So I set the output_style to :compressed to minified the CSS result. This is what I got in the result css file:

@import url("//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css").fa-apple,.fa-android,.fa-twitter{font-size:60px}

Compass removed the ending semicolon of the @import statement, which results in unexpected styling on the page.

When I changed output_style to :expanded, the page worked well with the unminified css version as the the semicolon was kept.

Is there a way to avoid Compass from removing the semicolon? And also why should it happen?

4

3 回答 3

1

sass 的最新版本(3.4.17 或 3.4.18)似乎正在这样做。

尝试这个:

gem uninstall sass
gem install sass -v 3.4.16

它对我有用。如果您想尝试其他版本,可以在这里找到所有版本的 sass 。

于 2015-08-26T10:46:26.917 回答
1

听起来这已在 3.4.18 中修复

于 2015-08-27T15:28:07.110 回答
0

指南针不应该将导入文件的代码呈现为 css 吗?

于 2015-08-25T19:31:32.227 回答