W
W
wakenby2021-03-17 22:01:22
gulp.js
wakenby, 2021-03-17 22:01:22

Why error from cleanCSS in gulp?

Here is the gulp config:

const { src, dest } = require('gulp')

const plumber = require('gulp-plumber')

const sass = require('gulp-sass')
const autoprefixer = require('gulp-autoprefixer')
const sassGlob = require('gulp-sass-glob')
const cleanCSS = require('gulp-clean-css')

function styles () {
    return src('#src/static/styles/styles.scss')
        .pipe(plumber())
        .pipe(sassGlob())
        .pipe(sass({outputStyle: 'expanded'}))
        .pipe(cleanCSS())
        .pipe(autoprefixer())
        .pipe(dest('dist/css'))
}

exports.styles = styles


And everything works if cleanCSS() is removed, but an error occurs with it:

Ignoring local @import of "#src/static/styles/styles.css" as resource is missing.


I don't understand what's wrong with cleanCSS.

Here is the styles.scss code:

a {
  display: flex;
  align-items: center;
}

.shorthand {
  font-style: italic;
  font-weight: bold;
  font-size: .8em;
  line-height: 1.2;
  font-family: Arial, sans-serif;
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dMn91, 2021-09-09
@dMn91

Faced the same problem when setting up gulp according to this video tutorial. This is a bug because of the "#" character. Something breaks in the plugin when using it. Rename the #src folder to src, and don't forget to make the same change to the sourceFolder variable. IMHO, all these "own developments" are doubtful. I sat for two hours looking for what the problem was.

V
Vyach Gor, 2021-03-18
@sharnirio

I'm guessing the folder for the files is still called 'src', not '#src'
so change the path to the file return src('src/static/styles/styles.scss')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question