Answer the question
In order to leave comments, you need to log in
Gulp throws an error when compiling sass after including a variable. Error: Undefined variable: "$text-color-light". What to do?
The gulp file looks like this:
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var concatCss = require('gulp-concat-css');
var ftp = require('gulp-ftp');
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: "./src"
});
// Следим за изменением файлов
gulp.watch("src/sass/**/*.sass", ['sass']);
gulp.watch("src/*.html").on('change', browserSync.reload);
});
// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
return gulp.src("src/sass/**/*.sass")
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(concatCss("main.css"))
.pipe(gulp.dest("src/css"))
.pipe(browserSync.stream());
});
gulp.task('ftp', function(){
return gulp.src('src/**')
.pipe(ftp({
host: '',
user: '',
pass: '',
remotePath: ''
}))
.pipe(gutil.noop());
});
gulp.task('default', ['serve']);
$text-color-dark: #373737
$text-color-light: #ffffff
@import 'header'
@import 'variables'
.header
&-contacts
display: flex
justify-content: flex-end
&__phone
font-size: 22px
&__button
font-size: 14px
color: $text-color-light
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