7
7
7GIT2020-11-15 20:03:11
gulp.js
7GIT, 2020-11-15 20:03:11

How to configure Gulp so that it knows what to take and where and how to give?

Translate gulp the following, I can't anymore:
1. Dear gulp, please take this dev/pug/*.pug and save it to dist .
Now, kindly save this dev/pug/pages/*.pug to dist/pages .
Thanks Gulp!

Taxi PUG:

The first action Gupl understands.
const gulp = require('gulp');
const htmlValidator = require('gulp-w3c-html-validator');
const plumber = require('gulp-plumber');
const pug = require('gulp-pug');
const argv = require('yargs').argv;
const gulpif = require('gulp-if');

// Ебашим Pug в HTML
module.exports = function pug2html() {
  return gulp.src('dev/pug/*.pug')
    .pipe(plumber())
    .pipe(pug())
    .pipe(plumber.stop())
    .pipe(gulpif(argv.prod, htmlValidator()))
    .pipe(gulp.dest('dist'))
};

The second action Gulp does not understand.
const gulp = require('gulp');
const htmlValidator = require('gulp-w3c-html-validator');
const plumber = require('gulp-plumber');
const pug = require('gulp-pug');
const argv = require('yargs').argv;
const gulpif = require('gulp-if');

// Ебашим Pug в HTML
module.exports = function pug2html() {
  return gulp.src(['dev/pug/*.pug', 'dev/pug/pages/*.pug'])
    .pipe(plumber())
    .pipe(pug())
    .pipe(plumber.stop())
    .pipe(gulpif(argv.prod, htmlValidator()))
    .pipe(gulp.dest('dist'))
};


Explain this abroad ;-)
jy5grlz5nwz3x136v65lahxqxcw.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
7
7GIT, 2020-11-15
@7GIT

It helped 'dev/pug/!(helpers|layout)**/*pug' - exclude folders !(helpers|layout)

module.exports = function pug2html() {
  return gulp.src([
    'dev/pug/*pug',
    'dev/pug/!(helpers|layout)**/*pug'
  ])
    .pipe(plumber())
    .pipe(pug())
    .pipe(plumber.stop())
    .pipe(gulpif(argv.prod, htmlValidator()))
    .pipe(gulp.dest('dist'))
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question