Answer the question
In order to leave comments, you need to log in
Why doesn't Gulp pass all HTML pages?
Specifically, the last folder does not go through:
- views
- am
- az
- by
- eu
- fi
- ge
- general
- kg
- kz
- md
- pt
- ru
That's just the last folder - - ru it doesn't work, deleting any other folder, this folder starts to be "read" by gulp. Tell me, at least in which direction to look, approximately.
Gulp file content:
'use strict';
var gulp = require('gulp'),
watch = require('gulp-watch'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
rigger = require('gulp-rigger'),
rename = require('gulp-rename'),
cleanCSS = require('gulp-clean-css'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
rimraf = require('rimraf'),
includer = require("gulp-x-includer"),
fileinclude = require('gulp-ex-file-include'),
browserSync = require("browser-sync"),
reload = browserSync.reload,
svgstore = require('gulp-svgstore'),
svgmin = require('gulp-svgmin'),
path = require('path'),
cheerio = require('gulp-cheerio');
var way = {
build: {
html: 'dist/',
js: 'dist/js/',
css: 'dist/css/'
},
src: {
html: 'src/views/**/**/*.html',
js: 'src/js/*.js',
styles: 'src/styles/**/*.scss'
},
watch: {
html: 'src/views/**/**/*.html',
js: 'src/js/*.js',
styles: 'src/styles/*.scss',
styles_blocks: 'src/styles/bocks/*.scss',
styles_common: 'src/styles/common/*.scss',
styles_lib: 'src/styles/lib/*.scss'
}
};
var config = {
server: {
baseDir: "./dist"
},
tunnel: false,
host: 'localhost',
port: 9000,
logPrefix: "frontend"
};
gulp.task('webserver', function () {
browserSync(config);
});
gulp.task('html:build', function () {
gulp.src(way.src.html)
.pipe(fileinclude({
context: {
menuOther: false,
menuByKz: false,
menuBtn: false,
homeScriptRU: false,
contactsScriptRU: false,
maiSocial: false,
breadcrumbShow: false
}
}))
.pipe(gulp.dest(way.build.html))
.pipe(reload({
stream: true
}));
});
gulp.task('js:build', function () {
gulp.src(way.src.js)
.pipe(rigger())
.pipe(uglify())
.pipe(gulp.dest(way.build.js))
.pipe(reload({
stream: true
}));
});
gulp.task('styles:build', function () {
gulp.src(way.src.styles)
.pipe(sass({
outputStyle: 'compressed',
includePaths: ['src/styles/'],
errLogToConsole: true
}).on('error', sass.logError)) //Скомпилируем
.pipe(gulp.dest(way.build.css)) //И в build
.pipe(rename({
prefix: "",
suffix: ".min",
extname: ".css"
}))
.pipe(autoprefixer({
browsers: ['last 5 versions'],
cascade: false
})) //Добавим вендорные префиксы
.pipe(cleanCSS({debug: true}, function (details) {//Сожмем
console.log(details.name + ': ' + details.stats.originalSize);
console.log(details.name + ': ' + details.stats.minifiedSize);
}))
.pipe(gulp.dest(way.build.css)) //И в build
.pipe(reload({
stream: true
}));
});
gulp.task('build', [
'html:build',
'js:build',
'styles:build'
]);
gulp.task('watch', function () {
watch([way.watch.html], function (event, cb) {
gulp.start('html:build');
});
watch([way.watch.styles], function (event, cb) {
gulp.start('styles:build');
});
watch([way.watch.styles_common], function (event, cb) {
gulp.start('styles:build');
});
watch([way.watch.styles_blocks], function (event, cb) {
gulp.start('styles:build');
});
watch([way.watch.styles_lib], function (event, cb) {
gulp.start('styles:build');
});
watch([way.watch.js], function (event, cb) {
gulp.start('js:build');
});
});
gulp.task('default', ['build', 'webserver', 'watch']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question