From 37ecce6290f51f7599cd0b6723b8ee490b35f53a Mon Sep 17 00:00:00 2001 From: Roman Axelrod Date: Wed, 23 Nov 2022 22:15:27 +0200 Subject: [PATCH] Fix windows paths in Gulp scripts. --- server.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server.js b/server.js index 012282b..062bae0 100755 --- a/server.js +++ b/server.js @@ -33,7 +33,6 @@ const {isDev, modulesPath, projectPath, developmentBlockName} = getConfigs(); const blocksRegistry = isDev ? 'http://localhost:3020' : PRODUCTION_REGISTRY_URL; - /** * Init server */ @@ -222,7 +221,7 @@ function startBrowserSync() { return cb(); }])); - gulp.watch(path.join(projectPath, 'src/**/*.scss'), {delay: 400}, gulp.series(['build-styling-files', function (cb) { + gulp.watch(getPathFiles(projectPath, "src/**/*.scss"), {delay: 400}, gulp.series(['build-styling-files', function (cb) { browserSyncReload(bs, 'css', 'Style Files Change'); return cb(); }])); @@ -276,7 +275,7 @@ function browserSyncReload(bs, extension = '', message = '') { } function getJSBundleFiles() { - return [path.join(projectPath, 'src/**/*.js'), path.join(projectPath, 'src/**/*.mjs'), '!' + path.join(projectPath, 'src/**/*.min.js')]; + return [getPathFiles(projectPath, "src/**/*.js"), getPathFiles(projectPath, "src/**/*.mjs"), "!" + getPathFiles(projectPath, "src/**/*.min.js")]; } function buildScriptFiles(done) { @@ -292,7 +291,7 @@ function buildScriptFiles(done) { .pipe(uglify()) .pipe(rename({extname: '.min.js'})) .pipe(sourcemaps.write('.')) - .pipe(gulp.dest(path.join(projectPath, 'src/'))); + .pipe(gulp.dest(getPathFiles(projectPath, 'src'))); } function buildStyleFiles(done) { @@ -306,7 +305,7 @@ function buildStyleFiles(done) { // .pipe(gulp.dest('src/')) .pipe(rename({extname: '.min.css'})) .pipe(sourcemaps.write('.', {})) - .pipe(gulp.dest(path.join(projectPath, 'src'))) + .pipe(gulp.dest(getPathFiles(projectPath, 'src'))) } function buildAssetFiles() { @@ -413,3 +412,7 @@ console.log('Configs', { developmentBlockName }); console.log('\n----------------------------------\n') + +function getPathFiles(...paths) { + return path.join(...paths).replace(/\\\\/g, '/'); +}