gulp игнорирует шрифты woff2 во время сборки и копировании нужных файлов в папку build. просто woff копирует прекрасно.
var gulp = require("gulp");
var less = require("gulp-less");
var sourcemap = require("gulp-sourcemaps");
var gulpstylelint = require("gulp-stylelint");
var postcss = require("gulp-postcss");
var autoprefixer = require("autoprefixer");
var posthtml = require("gulp-posthtml");
var include = require("posthtml-include");
var csso = require("gulp-csso");
var rename = require("gulp-rename");
var imagemin = require("gulp-imagemin");
var webp = require("gulp-webp");
var svgstore = require("gulp-svgstore");
var del = require("del");
var server = require("browser-sync").create();
var ghPages = require('gh-pages');
var path = require('path');
gulp.task("css", function () {
return gulp.src("source/less/style.less")
.pipe(sourcemap.init())
.pipe(less())
.pipe(postcss([
autoprefixer()
]))
// .pipe(csso())
// .pipe(rename("style.min.css"))
.pipe(sourcemap.write("."))
.pipe(gulp.dest("build/css"))
.pipe(server.stream());
});
gulp.task("images", function () {
return gulp.src("source/img/**/*{png, jpg, svg}")
.pipe(imagemin([
imagemin.optipng({optimizationLevel: 3}),
imagemin.jpegtran({progressive: true}),
imagemin.svgo()
]))
.pipe(gulp.dest("source/img"));
});
gulp.task("webp", function () {
return gulp.src("source/img/**/*{png, jpg}")
.pipe(webp({quality: 90}))
.pipe(gulp.dest("source/img"));
})
gulp.task("sprite", function () {
return gulp.src("source/img/icon-*.svg")
.pipe(svgstore({
inlineSvg: true
}))
.pipe(rename("sprite.svg"))
.pipe(gulp.dest("build/img"));
})
gulp.task("html", function () {
return gulp.src("source/*.html")
.pipe(posthtml([
include()
]))
.pipe(gulp.dest("build"));
})
gulp.task("server", function () {
server.init({
server: "build/"
});
gulp.watch("source/less/**/*.less", gulp.series("css"));
gulp.watch("source/img/icon-*.svg", gulp.series("sprite", "html", "refresh"));
gulp.watch("source/*.html", gulp.series("html", "refresh"));
});
gulp.task("refresh", function (done) {
server.reload();
done();
});
gulp.task("copy", function () {
return gulp.src([
"source/fonts/**/*.{woff, woff2}",
"source/img/**",
"source/js/**",
"source/*.ico"
], {
base: "source"
})
.pipe(gulp.dest("build"));
})
gulp.task("clean", function () {
return del("build");
})
gulp.task("stylelint", function () {
return gulp.src("source/less/**/*.less")
.pipe(gulpstylelint({
reporters: [
{formatter: 'string', console: true}
]
}));
});
function deploy(cb) {
ghPages.publish(path.join(process.cwd(), './build'), cb);
}
exports.deploy = deploy;
gulp.task("build", gulp.series("clean", "copy", "css", "sprite", "html"));
gulp.task("start", gulp.series("build", "server"));