i use cssnext to write my css
:root{
--ellipsis: {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
};
};
and use @apply --ellipsis in 3 places
.div1{
@apply --ellipsis
}
.div2{
@apply --ellipsis
}
.div3{
@apply --ellipsis
}
and i use gulp and postcss-cssnext
gulp.task('postcss',function(){
return gulp.src('src/css/*.css')
.pipe(plumber())
.pipe(postcss([
cssnext({
browsers: ['last 2 versions', 'Android >= 4.0'],
features: {
rem: false
}
})
]))
.pipe(gulp.dest('dist/css'))
});
but only the first place is useful,
.div1{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.div2{
}
.div3{
}
i have to write like this:
:root{
--ellipsis: {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
};
};
.div1{
@apply --ellipsis
}
:root{
--ellipsis: {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
};
};
.div2{
@apply --ellipsis
}
:root{
--ellipsis: {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
};
};
.div3{
@apply --ellipsis
}
but this must not be written like that,there must be something wrong...
"devDependencies": {
"autoprefixer": "^7.1.1",
"gulp": "^3.9.1",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^7.0.0",
"postcss-cssnext": "^2.11.0",
}
who can save me....
oh...I fixed it myself....
I feel that is not my fault but the problem of gulp-postcss,it is the newest version,so I install an old one 6.4.0,and it worked...