gpt4 book ai didi

css - SCSS、 compass 和 GULP : How to minify without breaking CSS?

转载 作者:太空宇宙 更新时间:2023-11-04 11:48:16 25 4
gpt4 key购买 nike

我正在使用 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 不会被读取。

JSFiddle with minified code

JSfildde with non-minified code

tags-barux-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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com