Добрый день, сразу говорю мои знания js и галпа очень начальные.
Работаю рабом в одной маленькой конторе и нет у меня ни кода ревью, ни тим.,тех.лида и главного разраба. Потому я тут
Цель - настроить галп.
Проблема - меня смущает в терминале следующая запись - [Browsersync] Reloading Browsers... (buffered 8 events). Является ли это проблемой и как это решить?
Мой галпфайл
const gulp = require('gulp'), //основной плагин gulp
stylus = require('gulp-stylus'), //препроцессор stylus
browserSync = require('browser-sync'),
maps = require('gulp-sourcemaps'),
concat = require('gulp-concat'), // конкатенация (используется для js)
uglify = require('gulp-uglifyjs'), //минификация js
csso = require('gulp-csso'),
rename = require('gulp-rename'),
del = require('del'),
autoprefixer = require('gulp-autoprefixer'), //расставление автопрефиксов
imagemin = require('gulp-imagemin'), //минимизация изображений
fileinclude = require('gulp-file-include'); // инклюд js и html
plumber = require('gulp-plumber')
watch = require('gulp-watch');
gulp.task('css', () => {
return gulp
.src('app/stylus/main.styl')
.pipe(plumber())
.pipe(maps.init())
.pipe(stylus())
.pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'],
{ cascade: true }))
.pipe(csso())
.pipe(rename({
suffix:'.min'
}))
.pipe(maps.write())
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.stream())
});
gulp.task('html', () => {
return gulp
.src('app/**/*.html')
.pipe(plumber())
.pipe(plumber.stop())
.pipe(fileinclude())
.pipe(gulp.dest('dist/'))
.pipe(browserSync.stream());
});
gulp.task('img', () => {
return gulp.src('app/img/**/*.*')
.pipe(imagemin([
imagemin.gifsicle({interlaced: true}),
imagemin.jpegtran({progressive: true}),
imagemin.optipng({optimizationLevel: 5}),
imagemin.svgo({
plugins: [
{removeViewBox: true},
{cleanupIDs: false}
]
})
]))
.pipe(gulp.dest('dist/img'));
});
gulp.task('fonts',() => {
var buildFonts = gulp.src('app/fonts/**/*')
.pipe(gulp.dest('dist/fonts'));
})
gulp.task('js', () => {
return gulp.src('app/js/**/*.js')
.pipe(gulp.dest('dist/'))
.pipe(browserSync.stream())
});
gulp.task('reload', () => {
browserSync({
server: {
baseDir: 'dist/'
},
notify: false,
});
});
/* gulp-clean для очистки сборочной директории
*/
gulp.task('clean', function() {
return del.sync('dist');
});
gulp.task('fileinclude', function() {
gulp.src(['app/**/*.html'])
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest('dist'))
.pipe(browserSync.stream());
});
gulp.task('watch', ['html','css','js','fileinclude', 'reload'], () => {
watch('app/stylus/**/*.styl', () => gulp.start('css'));
watch('app/*.html', () => gulp.start('html'));
});
Терминал
[12:21:34] Using gulpfile ~\Desktop\AAU\gulpfile.js
[12:21:34] Starting 'html'...
[12:21:34] Starting 'css'...
[12:21:34] Starting 'js'...
[12:21:34] Starting 'fileinclude'...
[12:21:34] Finished 'fileinclude' after 1.45 ms
[12:21:34] Starting 'reload'...
[12:21:34] Finished 'reload' after 138 ms
[12:21:34] Finished 'js' after 276 ms
[12:21:40] Finished 'css' after 5.63 s
[12:21:40] Finished 'html' after 5.74 s
[12:21:40] Starting 'watch'...
[12:21:40] Finished 'watch' after 53 ms
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.0.121:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://192.168.0.121:3001
--------------------------------------
[Browsersync] Serving files from: dist/
[12:21:54] Starting 'html'...
[Browsersync] 8 files changed (about.html, account.html, index.html, committee-partners.html, footer.html, general-partners-slider.html, header.html, information-media-partners-slider.html)
[12:21:54] Finished 'html' after 103 ms
[Browsersync] Reloading Browsers... (buffered 8 events)
[12:22:22] Starting 'html'...
[Browsersync] 8 files changed (about.html, account.html, index.html, committee-partners.html, footer.html, general-partners-slider.html, header.html, information-media-partners-slider.html)
[12:22:22] Finished 'html' after 92 ms
[Browsersync] Reloading Browsers... (buffered 8 events)
^CЗавершить выполнение пакетного файла [Y(да)/N(нет)]? ^Cy
PS C:\Users\MD_office\Desktop\AAU> gulp watch
[12:25:58] Using gulpfile ~\Desktop\AAU\gulpfile.js
[12:25:58] Starting 'html'...
[12:25:58] Starting 'css'...
[12:25:58] Starting 'js'...
[12:25:58] Starting 'fileinclude'...
[12:25:58] Finished 'fileinclude' after 1.49 ms
[12:25:58] Starting 'reload'...
[12:25:59] Finished 'reload' after 155 ms
[12:25:59] Finished 'js' after 286 ms
[12:26:04] Finished 'css' after 5.95 s
[12:26:04] Finished 'html' after 5.99 s
[12:26:04] Starting 'watch'...
[12:26:05] Finished 'watch' after 50 ms
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.0.121:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://192.168.0.121:3001
--------------------------------------
[Browsersync] Serving files from: dist/
[12:26:17] Starting 'html'...
[Browsersync] 8 files changed (about.html, account.html, index.html, committee-partners.html, footer.html, general-partners-slider.html, header.html, information-media-partners-slider.html)
[12:26:17] Finished 'html' after 92 ms
[Browsersync] Reloading Browsers... (buffered 8 events)
[12:26:24] Starting 'html'...
[Browsersync] 8 files changed (about.html, account.html, index.html, committee-partners.html, footer.html, general-partners-slider.html, header.html, information-media-partners-slider.html)
[12:26:24] Finished 'html' after 105 ms
[Browsersync] Reloading Browsers... (buffered 8 events)
[12:43:23] Starting 'html'...
[Browsersync] 8 files changed (about.html, account.html, index.html, committee-partners.html, footer.html, general-partners-slider.html, header.html, information-media-partners-slider.html)
[12:43:23] Finished 'html' after 124 ms
[Browsersync] Reloading Browsers... (buffered 8 events)
Буду благодарен за помощь, спасибо