Skip to content

Commit

Permalink
Добавлена сборка js модулей в режимах dev и build
Browse files Browse the repository at this point in the history
  • Loading branch information
niknov80 committed Apr 6, 2023
1 parent b12050b commit f9aa6f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import cheerio from 'gulp-cheerio';
import csso from 'postcss-csso';
import data from 'gulp-data';
import { deleteSync } from 'del';
import ifPlugin from 'gulp-if';
import fs from 'fs';
import notify from 'gulp-notify';
import plumber from 'gulp-plumber';
Expand Down Expand Up @@ -82,6 +83,11 @@ const imageOptimizeConfigs = {
}
}

const mode = {
isBuild: process.argv.includes('--build'),
isDev: !process.argv.includes('--build')
}

/**
* Основные задачи
*/
Expand Down Expand Up @@ -115,6 +121,7 @@ export const templates = () => src(`${path.templates.pages}*.j2`)
export const scripts = () => src(`${path.scripts.root}**/*.js`)
.pipe(sourcemaps.init())
.pipe(webpack({
mode: mode.isBuild ? 'production' : 'development',
output: {
filename: 'script.min.js',
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"gulp-csscomb": "latest",
"gulp-dart-sass": "latest",
"gulp-data": "latest",
"gulp-if": "^3.0.0",
"gulp-merge-json": "latest",
"gulp-notify": "latest",
"gulp-nunjucks-render": "latest",
Expand All @@ -38,7 +39,7 @@
"> 2%"
],
"scripts": {
"build": "gulp build",
"build": "gulp build --build",
"start": "gulp start",
"lint:styles": "stylelint 'src/sass/**/*.scss' --config .stylelintrc.json",
"lint:templates": "djlint src/templates --lint --configuration .djlintrc",
Expand Down

0 comments on commit f9aa6f5

Please sign in to comment.