Commit aaac4d36 authored by Nikolay Gromov's avatar Nikolay Gromov

Запилил сборку с и без библиотеки блоков

parent 97358011
...@@ -37,7 +37,11 @@ src/ ...@@ -37,7 +37,11 @@ src/
5. Запускается локальный сервер и слежение за файлами для пересборки. 5. Запускается локальный сервер и слежение за файлами для пересборки.
## Прочие команды ## Команды
`npm start` — сборка проекта **без библиотеки блоков**, слежение.
`npm run wlib` — сборка проекта с библиотекой блоков, слежение.
`npm run deploy` — Сборка проекта и отправка содержимого папки сборки на gh-pages `npm run deploy` — Сборка проекта и отправка содержимого папки сборки на gh-pages
......
...@@ -35,6 +35,7 @@ const path = require('path'); ...@@ -35,6 +35,7 @@ const path = require('path');
// Глобальные настройки этого запуска // Глобальные настройки этого запуска
const isDev = !process.env.NODE_ENV || process.env.NODE_ENV == 'dev'; const isDev = !process.env.NODE_ENV || process.env.NODE_ENV == 'dev';
const buildLibrary = process.env.BUILD_LIBRARY == 'yes' ? true : false;
const nth = {}; const nth = {};
nth.config = require('./config.js'); nth.config = require('./config.js');
nth.blocksFromHtml = []; // блоки из HTML (только если имеют свою папку блока!) nth.blocksFromHtml = []; // блоки из HTML (только если имеют свою папку блока!)
...@@ -210,10 +211,11 @@ exports.writeSassImportsFile = writeSassImportsFile; ...@@ -210,10 +211,11 @@ exports.writeSassImportsFile = writeSassImportsFile;
function compileSass() { function compileSass() {
return src([ const fileList = [
`${dir.src}scss/style.scss`, `${dir.src}scss/style.scss`,
`${dir.blocks}blocks-library/blocks-library.scss`, ];
], { sourcemaps: true }) if(buildLibrary) fileList.push(`${dir.blocks}blocks-library/blocks-library.scss`);
return src(fileList, { sourcemaps: true })
.pipe(plumber({ .pipe(plumber({
errorHandler: function (err) { errorHandler: function (err) {
console.log(err.message); console.log(err.message);
...@@ -254,14 +256,15 @@ exports.writeJsRequiresFile = writeJsRequiresFile; ...@@ -254,14 +256,15 @@ exports.writeJsRequiresFile = writeJsRequiresFile;
function buildJs() { function buildJs() {
const entryList = {
'bundle': `./${dir.src}js/entry.js`,
};
if(buildLibrary) entryList['blocks-library'] = `./${dir.blocks}blocks-library/blocks-library.js`;
return src(`${dir.src}js/entry.js`) return src(`${dir.src}js/entry.js`)
.pipe(plumber()) .pipe(plumber())
.pipe(webpackStream({ .pipe(webpackStream({
mode: 'development', mode: 'development',
entry: { entry: entryList,
'bundle': `./${dir.src}js/entry.js`,
'blocks-library': `./${dir.blocks}blocks-library/blocks-library.js`,
},
output: { output: {
filename: '[name].js', filename: '[name].js',
}, },
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"scripts": { "scripts": {
"test:style": "stylelint \"src/**/*.scss\" --syntax=scss", "test:style": "stylelint \"src/**/*.scss\" --syntax=scss",
"start": "gulp", "start": "gulp",
"wlib": "cross-env BUILD_LIBRARY=yes gulp",
"deploy": "cross-env NODE_ENV=production ./node_modules/.bin/gulp build && cross-env ./node_modules/.bin/gulp deploy", "deploy": "cross-env NODE_ENV=production ./node_modules/.bin/gulp build && cross-env ./node_modules/.bin/gulp deploy",
"build": "cross-env NODE_ENV=production npm start build", "build": "cross-env NODE_ENV=production npm start build",
"lint-staged": "lint-staged" "lint-staged": "lint-staged"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment