Skip to content

Commit

Permalink
Merge branch 'hotfix/1.5.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
Igloczek committed Feb 14, 2018
2 parents 95e1668 + 1977476 commit 927d63b
Show file tree
Hide file tree
Showing 4 changed files with 1,259 additions and 426 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "snowdog/frontools",
"description": "Set of front-end tools for Magento 2, based on Gulp.js",
"version": "1.5.10",
"version": "1.5.11",
"license": "MIT",
"type": "magento2-component"
}
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "magento2-frontools",
"version": "1.5.9",
"version": "1.5.11",
"author": {
"name": "Bartek Igielski",
"email": "[email protected]"
Expand All @@ -12,42 +12,43 @@
},
"license": "MIT",
"dependencies": {
"autoprefixer": "~7.2.1",
"autoprefixer": "~8.0.0",
"babel-core": "~6.26.0",
"babel-preset-env": "~1.6.1",
"browser-sync": "~2.18.13",
"chokidar": "~1.7.0",
"browser-sync": "~2.23.6",
"chokidar": "~2.0.2",
"cssnano": "~3.10.0",
"eslint-config-idiomatic": "~4.0.0",
"fs-extra": "~4.0.2",
"globby": "~7.1.1",
"fs-extra": "~5.0.0",
"globby": "~8.0.0",
"gulp": "~3.9.1",
"gulp-babel": "~6.0.0",
"gulp-babel": "~7.0.1",
"gulp-concat": "~2.6.1",
"gulp-eslint": "~4.0.0",
"gulp-eslint": "~4.0.2",
"gulp-if": "~2.0.2",
"gulp-load-plugins": "~1.5.0",
"gulp-logger": "~0.0.2",
"gulp-multi-dest": "~0.0.4",
"gulp-notify": "~3.0.0",
"gulp-plumber": "~1.1.0",
"gulp-postcss": "~7.0.0",
"gulp-multi-dest": "~1.3.7",
"gulp-notify": "~3.2.0",
"gulp-plumber": "~1.2.0",
"gulp-postcss": "~7.0.1",
"gulp-rename": "~1.2.2",
"gulp-rimraf": "~0.2.1",
"gulp-rimraf": "~0.2.2",
"gulp-sass": "~3.1.0",
"gulp-sass-error": "~1.0.5",
"gulp-sass-lint": "~1.3.4",
"gulp-sourcemaps": "~2.6.1",
"gulp-sourcemaps": "~2.6.4",
"gulp-svg-sprite": "~1.3.7",
"gulp-task-loader": "~1.4.4",
"gulp-uglify": "~3.0.0",
"gulp-util": "~3.0.8",
"js-yaml": "~3.10.0",
"marked": "~0.3.7",
"marked": "~0.3.12",
"marked-terminal": "~2.0.0",
"merge-stream": "~1.0.1",
"postcss-reporter": "~5.0.0",
"run-sequence": "~2.2.0",
"stylelint": "~8.3.1",
"run-sequence": "~2.2.1",
"stylelint": "~8.4.0",
"stylelint-config-standard": "~18.0.0"
},
"scripts": {
Expand Down
28 changes: 18 additions & 10 deletions task/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = function(resolve) { // eslint-disable-line func-names
destWatcher = plugins.chokidar.watch(themeDest, watcherConfig);

let reinitTimeout = false,
reinitPaths = [],
sassDependecyTree = {};

function generateSassDependencyTree() {
Expand All @@ -68,15 +69,18 @@ module.exports = function(resolve) { // eslint-disable-line func-names
function reinitialize(path) {
// Reset previously set timeout
clearTimeout(reinitTimeout);
reinitPaths.push(path);

// Timeout to run only once while moving or renaming files
reinitTimeout = setTimeout(() => {
const paths = reinitPaths;
reinitPaths = [];

plugins.util.log(
plugins.util.colors.yellow('Change detected.') + ' ' +
plugins.util.colors.green('Theme:') + ' ' +
plugins.util.colors.blue(name) + ' ' +
plugins.util.colors.green('File:') + ' ' +
plugins.util.colors.blue(plugins.path.relative(config.projectPath, path))
plugins.util.colors.green(`${paths.length} file(s) changed`)
);

plugins.util.log(
Expand All @@ -97,10 +101,14 @@ module.exports = function(resolve) { // eslint-disable-line func-names
tempWatcher.add(themeTempSrc);

// Emit event on added / moved / renamed / deleted file to trigger regualr pipeline
plugins.globby.sync(themeTempSrc + '/**/' + plugins.path.basename(path))
.forEach(file => {
tempWatcher.emit('change', file);
});
paths.forEach(path => {
if (plugins.fs.existsSync(path)) {
plugins.globby.sync(themeTempSrc + '/**/' + plugins.path.basename(path))
.forEach(file => {
tempWatcher.emit('change', file);
});
}
});
});
}, 100);
}
Expand Down Expand Up @@ -130,7 +138,7 @@ module.exports = function(resolve) { // eslint-disable-line func-names
plugins.util.colors.green('Theme:') + ' ' +
plugins.util.colors.blue(name) + ' ' +
plugins.util.colors.green('File:') + ' ' +
plugins.util.colors.blue(plugins.path.relative(config.projectPath, path))
plugins.util.colors.blue(plugins.path.relative(themeTempSrc, path))
);

// SASS Lint
Expand Down Expand Up @@ -160,9 +168,9 @@ module.exports = function(resolve) { // eslint-disable-line func-names
}

// Files that require reload after save
if (['.html', '.phtml', '.xml', '.csv', '.js'].some(ext => {
return plugins.path.extname(path) === ext;
})) {
if (['.html', '.phtml', '.xml', '.csv', '.js'].some(
ext => plugins.path.extname(path) === ext
)) {
plugins.browserSync.reload();
}
});
Expand Down
Loading

0 comments on commit 927d63b

Please sign in to comment.