A
A
Alexander Osadchy2019-07-08 13:44:05
JavaScript
Alexander Osadchy, 2019-07-08 13:44:05

How to add gulp plugin gulp-clean-css?

Hello!
Please help me to add the gulp-clean-css
plugin to my gulpfile.js. It is necessary that (if possible) both scss and css are collected in one optimized file
. My gulpfile.js

/* eslint-disable camelcase */
const {
  dest,
  parallel,
  series,
  src
} = require('gulp'),
  concat = require('gulp-concat'),
  del = require("del"),
  plumber = require('gulp-plumber'),
  rename = require('gulp-rename'),
  sass = require('gulp-sass'),
  cleanCSS = require('gulp-clean-css');

const Wlax = {
  all: [
    './src/*.*',
    './src/fonts/*.*',
    './src/img/**/*.*',
    '!./src/**/*.scss',
    '!./src/*.scss',
    '!./src/css/*.css',
    '!./src/**/*.js'
  ],
  scss: './src/css/*.scss',
  aljs: [
    './src/js/*.js'
  ],
  pub: 'dist/',
  css: './dist/css',
  js: './dist/js'
}

const clear = () => del(Wlax.pub).then((paths) => {
  console.log('Deleted files and folders:\n', paths.join('\n'));
});

const css = () => src(Wlax.scss).
  pipe(concat('dist')).
  pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError)).
  pipe(rename('all.min.css')).

  pipe(dest(Wlax.css));


const js = () => src(Wlax.aljs).
  pipe(concat('dist')).
  pipe(rename('nd.bild.js')).
  pipe(dest(Wlax.js));
exports.clean = clear;
exports.styles = css;
exports.scripts = js;
// exports.all = allf;

// exports.build = series(clear, parallel(allf, css, js));
// exports.default = series(clear, parallel(allf, css, js));

exports.build = series(clear, parallel(css, js));
exports.default = series(clear, parallel(css, js));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CoyoteSS, 2019-07-08
@CoyoteSS

You don't use cleanCSS anywhere

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question