Commit 0c2ae022 authored by Nikolay Gromov's avatar Nikolay Gromov

Избавился от сегментов **/ в вотчере стилей

parent 0c42a169
...@@ -26,7 +26,7 @@ const newer = require('gulp-newer'); ...@@ -26,7 +26,7 @@ const newer = require('gulp-newer');
let projectConfig = require('./projectConfig.json'); let projectConfig = require('./projectConfig.json');
let dirs = projectConfig.dirs; let dirs = projectConfig.dirs;
let lists = getFilesList(projectConfig); let lists = getFilesList(projectConfig);
console.log(lists); // console.log(lists);
// Получение адреса репозитория // Получение адреса репозитория
let repoUrl = require('./package.json').repository.url.replace(/\.git$/g, ''); let repoUrl = require('./package.json').repository.url.replace(/\.git$/g, '');
...@@ -94,7 +94,7 @@ gulp.task('style', function () { ...@@ -94,7 +94,7 @@ gulp.task('style', function () {
.pipe(wait(100)) .pipe(wait(100))
.pipe(gulpIf(isDev, sourcemaps.init())) .pipe(gulpIf(isDev, sourcemaps.init()))
.pipe(debug({title: "Style:"})) .pipe(debug({title: "Style:"}))
.pipe(sass()) .pipe(sass({includePaths: [__dirname+'/']}))
.pipe(postcss(postCssPlugins)) .pipe(postcss(postCssPlugins))
.pipe(insert.append(styleFileMsg)) .pipe(insert.append(styleFileMsg))
.pipe(gulpIf(!isDev, cleanss())) .pipe(gulpIf(!isDev, cleanss()))
...@@ -425,12 +425,17 @@ gulp.task('serve', gulp.series('build', function() { ...@@ -425,12 +425,17 @@ gulp.task('serve', gulp.series('build', function() {
open: false, open: false,
}); });
gulp.watch([ // Стили
dirs.srcPath + 'scss/**/*.scss', let stylePaths = [
dirs.srcPath + dirs.blocksDirName + '/**/*.scss', dirs.srcPath + 'scss/style.scss',
projectConfig.addCssBefore, dirs.srcPath + 'scss/mixins/*.scss',
projectConfig.addCssAfter, ];
], gulp.series('style')); for (let i = 0, len = lists.blocksDirs.length; i < len; ++i) {
stylePaths.push(dirs.srcPath + lists.blocksDirs[i] + '*.scss');
}
stylePaths.concat(projectConfig.addCssBefore, projectConfig.addCssAfter);
// console.log(stylePaths);
gulp.watch(stylePaths, gulp.series('style'));
if(projectConfig.singleCompiled.length) { if(projectConfig.singleCompiled.length) {
gulp.watch(projectConfig.singleCompiled, gulp.series('style:single')); gulp.watch(projectConfig.singleCompiled, gulp.series('style:single'));
...@@ -487,7 +492,7 @@ function getFilesList(config){ ...@@ -487,7 +492,7 @@ function getFilesList(config){
'js': [], 'js': [],
'img': [], 'img': [],
'pug': [], 'pug': [],
// 'blocksDirs': [], 'blocksDirs': [],
}; };
// Обходим массив с блоками проекта // Обходим массив с блоками проекта
...@@ -539,7 +544,7 @@ function getFilesList(config){ ...@@ -539,7 +544,7 @@ function getFilesList(config){
res.img.push(config.dirs.srcPath + config.dirs.blocksDirName + '/' + blockName + '/img/*.{jpg,jpeg,gif,png,svg}'); res.img.push(config.dirs.srcPath + config.dirs.blocksDirName + '/' + blockName + '/img/*.{jpg,jpeg,gif,png,svg}');
// Список директорий // Список директорий
// res.blocksDirs.push(config.dirs.blocksDirName + '/' + blockName + '/'); res.blocksDirs.push(config.dirs.blocksDirName + '/' + blockName + '/');
} }
else { else {
......
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