Answer the question
In order to leave comments, you need to log in
Can Gulp-Sass preprocessor do this?
If I write scss code like this:
.header {
padding: 10px;
}
.main {
margin: 10px;
}
.footer {
font-size: 10px;
}
@media (min-width: 320px) {
.header {
padding: 20px;
}
.main {
margin: 20px;
}
.footer {
font-size: 20px;
}
}
@media (min-width: 660px) {
.header {
padding: 60px;
}
.main {
margin: 10px;
}
.footer {
font-size: 10px;
}
}
function style() {
return gulp.src('./source/sass/*.scss')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({cascade: true}))
.pipe(gulp.dest('./build/css'))
.pipe(cleancss( {level: { 1: { specialComments: 0 } } }))
.pipe(rename({ suffix: '.min', prefix : '' }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./build/css'))
.pipe(browsersync.stream());
};
.header {
padding: 10px; }
.main {
margin: 10px; }
.footer {
font-size: 10px; }
@media (min-width: 320px) {
.header {
padding: 20px; }
.main {
margin: 20px; }
.footer {
font-size: 20px; } }
@media (min-width: 660px) {
.header {
padding: 60px; }
.main {
margin: 60px; }
.footer {
font-size: 60px; } }
.header {
padding: 10px;
@media (min-width: 320px) {
padding: 20px;
}
@media (min-width: 660px) {
padding: 60px;
}
}
.main {
margin: 10px;
@media (min-width: 320px) {
margin: 20px;
}
@media (min-width: 660px) {
margin: 10px;
}
}
.footer {
font-size: 10px;
@media (min-width: 320px) {
font-size: 20px;
}
@media (min-width: 660px) {
font-size: 10px;
}
}
.header {
padding: 10px; }
@media (min-width: 320px) {
.header {
padding: 20px; } }
@media (min-width: 660px) {
.header {
padding: 60px; } }
.main {
margin: 10px; }
@media (min-width: 320px) {
.main {
margin: 20px; } }
@media (min-width: 660px) {
.main {
margin: 10px; } }
.footer {
font-size: 10px; }
@media (min-width: 320px) {
.footer {
font-size: 20px; } }
@media (min-width: 660px) {
.footer {
font-size: 10px; } }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question