Answer the question
In order to leave comments, you need to log in
Where is the error in the task?
I'm trying to set up a gulp-uncss task , but for some reason I'm getting an error.
'use strict';
const $ = require('gulp-load-plugins')();
const gulp = require('gulp');
const config = require('../../../config');
const lessUncss = require('gulp-uncss');
const lessPluginAutoPrefix = require('less-plugin-autoprefix');
const lessPluginCleanCSS = require('less-plugin-clean-css');
var autoprefixer = new lessPluginAutoPrefix(config.autoprefixer),
cleancss = new lessPluginCleanCSS({ advanced: true });
uncss = new lessUncss,
module.exports = function(options) {
return config.wrapPipe(function(success, error) {
return gulp.src(config.less.src)
.pipe($.less({
plugins: [autoprefixer, cleancss],
}).on('error', error))
.pipe($.csscomb())
.pipe($.csso())
.pipe(uncss({
html: ['/build/*.html']
}))
.pipe(gulp.dest(config.less.dest));
});
};
Answer the question
In order to leave comments, you need to log in
You have some mixture of bulldog (Gulp) and rhinohorm (webpack) here.
Here is a clean Gulp4
sass = require 'gulp-sass'
slim = require 'gulp-slim'
coffee = require 'gulp-coffee'
notify = require 'gulp-notify'
plumber = require 'gulp-plumber'
connect = require 'gulp-connect'
gulp = require 'gulp'
paths =
app: 'app'
sass: 'sass/**/*.scss'
slim: 'slim/**/*.slim'
coffee: 'coffee/**/*.coffee'
js: 'js/**/*.js'
########################################
########################################
tsass = ->
gulp.src paths.sass
.pipe plumber { errorHandler: notify.onError message: "<%= error.message %>", title: "Ошибка" }
.pipe sass outputStyle: 'expanded'
.pipe gulp.dest paths.app
.pipe connect.reload( )
########################################
tslim = ->
gulp.src paths.slim
.pipe plumber { errorHandler: notify.onError message: "<%= error.message %>", title: "Ошибка" }
.pipe slim pretty: true
.pipe gulp.dest paths.app
.pipe connect.reload( )
########################################
tjs = ->
gulp.src paths.js
.pipe plumber { errorHandler: notify.onError message: "<%= error.message %>", title: "Ошибка" }
.pipe gulp.dest paths.app
.pipe connect.reload( )
########################################
tcoffee = ->
gulp.src paths.coffee
.pipe plumber { errorHandler: notify.onError message: "<%= error.message %>", title: "Ошибка" }
.pipe coffee bare: true
.pipe gulp.dest paths.app
.pipe connect.reload( )
########################################
twatch = ->
gulp.watch paths.sass, tsass
gulp.watch paths.slim, tslim
gulp.watch paths.coffee, tcoffee
gulp.watch paths.js, tjs
########################################
tconnect = ->
connect.server
root: paths.app
port: 8888
livereload: true
########################################
watch = gulp.parallel tconnect,
gulp.series( gulp.parallel( tslim, tsass, tcoffee, tjs ), twatch )
gulp.task 'default', watch
module.exports in gulp - is it legal at all? I haven't seen this yet.
Well, at least I don't see the gulp task. And what error does it output?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question