windows-watch #4
@@ -221,7 +221,7 @@ function startBrowserSync() {
|
|||||||
return cb();
|
return cb();
|
||||||
}]));
|
}]));
|
||||||
|
|
||||||
gulp.watch(getPathFiles(projectPath, "src/**/*.scss"), {delay: 400}, gulp.series(['build-styling-files', function (cb) {
|
gulp.watch(path.posix.join(projectPath, "src/**/*.scss"), {delay: 400}, gulp.series(['build-styling-files', function (cb) {
|
||||||
browserSyncReload(bs, 'css', 'Style Files Change');
|
browserSyncReload(bs, 'css', 'Style Files Change');
|
||||||
return cb();
|
return cb();
|
||||||
}]));
|
}]));
|
||||||
@@ -275,12 +275,12 @@ function browserSyncReload(bs, extension = '', message = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getJSBundleFiles() {
|
function getJSBundleFiles() {
|
||||||
return [getPathFiles(projectPath, "src/**/*.js"), getPathFiles(projectPath, "src/**/*.mjs"), "!" + getPathFiles(projectPath, "src/**/*.min.js")];
|
return [path.posix.join(projectPath, "src/**/*.js"), path.posix.join(projectPath, "src/**/*.mjs"), "!" + path.posix.join(projectPath, "src/**/*.min.js")];
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildScriptFiles(done) {
|
function buildScriptFiles(done) {
|
||||||
const files = getJSBundleFiles();
|
const files = getJSBundleFiles();
|
||||||
return gulp.src(files)
|
return gulp.src(files, {base: path.posix.join(projectPath, 'src')})
|
||||||
.pipe(sourcemaps.init({}))
|
.pipe(sourcemaps.init({}))
|
||||||
.pipe(babel()).on('error', function (error) {
|
.pipe(babel()).on('error', function (error) {
|
||||||
showError(new PluginError('JavaScript', error).toString());
|
showError(new PluginError('JavaScript', error).toString());
|
||||||
@@ -291,11 +291,11 @@ function buildScriptFiles(done) {
|
|||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(rename({extname: '.min.js'}))
|
.pipe(rename({extname: '.min.js'}))
|
||||||
.pipe(sourcemaps.write('.'))
|
.pipe(sourcemaps.write('.'))
|
||||||
.pipe(gulp.dest(getPathFiles(projectPath, 'src')));
|
.pipe(gulp.dest(path.posix.join(projectPath, 'src')));
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildStyleFiles(done) {
|
function buildStyleFiles(done) {
|
||||||
return gulp.src(path.join(projectPath, 'src/**/*.scss'))
|
return gulp.src(path.join(projectPath, 'src/**/*.scss'), {base: path.posix.join(projectPath, 'src')})
|
||||||
.pipe(sourcemaps.init({}))
|
.pipe(sourcemaps.init({}))
|
||||||
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', function (error) {
|
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', function (error) {
|
||||||
showError(new PluginError('SCSS', error.messageFormatted).toString());
|
showError(new PluginError('SCSS', error.messageFormatted).toString());
|
||||||
@@ -305,7 +305,7 @@ function buildStyleFiles(done) {
|
|||||||
// .pipe(gulp.dest('src/'))
|
// .pipe(gulp.dest('src/'))
|
||||||
.pipe(rename({extname: '.min.css'}))
|
.pipe(rename({extname: '.min.css'}))
|
||||||
.pipe(sourcemaps.write('.', {}))
|
.pipe(sourcemaps.write('.', {}))
|
||||||
.pipe(gulp.dest(getPathFiles(projectPath, 'src')))
|
.pipe(gulp.dest(path.posix.join(projectPath, 'src')))
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildAssetFiles() {
|
function buildAssetFiles() {
|
||||||
@@ -412,7 +412,3 @@ console.log('Configs', {
|
|||||||
developmentBlockName
|
developmentBlockName
|
||||||
});
|
});
|
||||||
console.log('\n----------------------------------\n')
|
console.log('\n----------------------------------\n')
|
||||||
|
|
||||||
function getPathFiles(...paths) {
|
|
||||||
return path.join(...paths).replace(/\\\\/g, '/');
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user