我正在使用 Gulp-Compass并想缩小我的 CSS。
当我这样做时,下面的代码
.tags-bar .sub-bullet:nth-last-of-type {
display:none;
}
.ux-panel-hidden{
display:none;
}
缩小为:
.tags-bar .sub-bullet:nth-last-of-type,.ux-panel-hidden{display:none}
:nth-type
部分会混淆浏览器,因此 ux-panel-hidden
不会被读取。
JSfildde with non-minified code
tags-bar
和 ux-panel
在单独的 _scss 文件中,所以我不确定为什么缩小将它们放在一起。
我该如何解决?
这是我的 Gulp 代码:
gulp.task('compass', function() {
return gulp.src('frontend/build/css/*.scss')
.pipe(compass({
css: 'frontend/dist/css',
sass: 'frontend/build/css',
image: 'frontend/images/',
font: 'stylesheets/fonts',
require: ['susy', 'breakpoint'],
bundle_exec: true
}))
.pipe(plumber({
errorHandler: onError
}))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('frontend/dist/css'))
.pipe(rename({
suffix: '.min'
}))
.pipe(minifycss())
.pipe(gulp.dest('frontend/dist/css'))
.pipe(notify({ // Add gulpif here
sound: "Pop"
}));
});
最佳答案
:nth-last-of-type
不是有效的语法,因为它需要传递一个参数,例如。 :nth-last-of-type(奇数)
这可能会导致您的问题。
更多关于 CSS-Tricks 属性的阅读 https://css-tricks.com/almanac/selectors/n/nth-last-of-type/
关于css - SCSS、 compass 和 GULP : How to minify without breaking CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30817836/