A
A
Andy Oker2020-11-10 11:51:12
JavaScript
Andy Oker, 2020-11-10 11:51:12

Gulp-wepb-css won't let me import css file from node_modules. How to decide?

I want to connect the normalize.css file via import to a common scss file via import
5faa53f530dc1835052688.png
However, the gulp-webp-css plugin gives an error.
In gulpfile, this function manages this business:
5faa53dc932c5787307873.png

I would be glad for any feedback!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Litvinenko, 2020-11-21
@Litvinenko-Yury

Try gulp-sass which will compile scss files into one css file.
And the normalize.css extension must first be changed to normalize.scss.

S
Smexardix, 2020-12-06
@Smexardix

I have the same situation and I suffered all day.
And the solution is very simple! Drop the gulp-webp-css pipe ( .pipe(webpcss()) ) below the cleaner ( .pipe(clean_css()) ) and you'll end up with something like this:

function css() {
  return src(path.src.css)
    .pipe(
      scss({
        outputStyle: "expanded"
      })
    )
    .pipe(group_media())
    .pipe(
      autoprefixer({
        overrideBrowserslist: ["last 15 versions"],
        cascade: true
      })
    )
    // .pipe(webpcss())
    .pipe(dest(path.build.css))
    .pipe(clean_css())
    .pipe(webpcss())
    .pipe(rename({
      extname: ".min.css"
    }))
    .pipe(dest(path.build.css))
    .pipe(browsersync.stream())
}

Thank you for your attention!
PS: you can apply the minifier again after .pipe(webpcss()) before rename)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question