const changed = require('gulp-changed');
gulp.task('img', function() {
return combiner(
gulp.src(['frontend/assets/img/*.*']),
changed(['frontend/assets/img/*.*']),
gulp.dest('public/img')
).on('error', notify.onError());
});
[Browsersync] File event [change] : public\img\Truck Empty.svg
[Browsersync] File event [change] : public\img\Truck Full.svg
[Browsersync] File event [change] : public\img\arrow r btn.svg
[Browsersync] File event [change] : public\img\chart.jpg
[Browsersync] File event [change] : public\img\chart1.png
[Browsersync] File event [change] : public\img\dark.png
[Browsersync] File event [change] : public\img\face-manager.jpg
[Browsersync] File event [change] : public\img\face-manager.jpg.png
[Browsersync] File event [change] : public\img\icon Back.svg
[Browsersync] File event [change] : public\img\icon location.svg
[Browsersync] File event [change] : public\img\image3.jpg
[Browsersync] File event [change] : public\img\image_down.png
[Browsersync] File event [change] : public\img\image_part_down.png
[Browsersync] File event [change] : public\img\image_part_up.png
[Browsersync] File event [change] : public\img\image_up.png
[Browsersync] File event [change] : public\img\ligth.png
[Browsersync] File event [change] : public\img\line-dotted.png
[Browsersync] File event [change] : public\img\striped.png
[Browsersync] File event [change] : public\img\truck-bg.png
[Browsersync] File event [change] : public\img\way.svg
[Browsersync] File event [change] : public\img\Icon Paper D.svg
[Browsersync] File event [change] : public\img\icon paper atantion.svg
[Browsersync] File event [change] : public\img\icon paper text.svg
[Browsersync] File event [change] : public\img\podpisss.png
const changed = require('gulp-changed');
gulp.task('img', function() {
return combiner(
gulp.src(['frontend/assets/img/*.*']),
changed(),
gulp.dest('public/img')
).on('error', notify.onError());
});
[15:20:43] Starting 'img'...
[15:20:43] 'img' errored after 10 ms
[15:20:43] Error in plugin "gulp-changed"
Message:
`dest` required
Details:
domain: [object Object]
domainThrown: true
$(document).ready(function() {
$("#form").submit(function(e){
e.preventDefault();
});
$("#submit").click(function(){
login.senduth();
});
});
class Http {
constructor(params) {
this.params = params;
this.settings = settings;
}
send(params, settings) {
const http = new XMLHttpRequest()
http.open(JSON.stringify(settings))
http.setRequestHeader('Content-type', 'application/json')
http.send(JSON.stringify(params))
http.onload = function() {
//alert(http.responseText)
}
}
}
class Settings {
sett(params) {
const settings = {
method: 'POST',
url: 'login.json',
async: false
}
}
let http = new Http(params, settings);
http.send(params, settings);
}
class Login {
senduth() {
const params = {
login: document.querySelector('#login').value,
password: document.querySelector('#password').value
}
//let http = new Http(params);
//http.send(params);
let settings = new Settings(params);
settings.sett(params);
}
}
let login = new Login();
gulp.task('serve', function() {
browserSync.init({
server: 'public'
});
browserSync.watch('public/**/*.*').on('change',browserSync.reload);
});
PS C:\openserver\domains\potokblue\public> gulp
[16:36:11] Working directory changed to C:\openserver\domains\potokblue
[16:36:12] Using gulpfile C:\openserver\domains\potokblue\gulpfile.js
[16:36:12] Starting 'default'...
[16:36:12] Starting 'watch'...
[16:36:12] Starting 'serve'...
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.0.114:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://192.168.0.114:3001
--------------------------------------
[Browsersync] Serving files from: public
[16:36:23] Starting 'html'...
[Browsersync] Reloading Browsers...
[Browsersync] Reloading Browsers...
[Browsersync] Reloading Browsers...
[Browsersync] Reloading Browsers...
[16:36:24] Finished 'html' after 189 ms
[16:36:33] Starting 'html'...
[Browsersync] Reloading Browsers...
[Browsersync] Reloading Browsers...
[Browsersync] Reloading Browsers...
[Browsersync] Reloading Browsers...
[16:36:33] Finished 'html' after 238 ms
[Browsersync] Reloading Browsers...
PS C:\openserver\domains\potokblue> gulp serve
[16:32:30] Using gulpfile C:\openserver\domains\potokblue\gulpfile.js
[16:32:30] Starting 'serve'...
[16:32:30] 'serve' errored after 17 ms
[16:32:30] TypeError: "listener" argument must be a function
at _addListener (events.js:216:11)
at FSWatcher.addListener (events.js:276:10)
at C:\openserver\domains\potokblue\gulpfile.js:123:40
at taskWrapper (C:\openserver\domains\node_modules\undertaker\lib\set-task.js:13:15)
at bound (domain.js:280:14)
at runBound (domain.js:293:12)
at asyncRunner (C:\openserver\domains\node_modules\async-done\index.js:36:18)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
npm i -g gulp-cli
gulp dev
[16:04:35] Using gulpfile ~\Downloads\OpenServer\domains\potokblue\gulpfile.js
[16:04:35] Starting 'dev'...
[16:04:35] Starting 'build'...
[16:04:35] Starting 'clean'...
[16:04:35] Finished 'clean' after 69 ms
[16:04:35] Starting 'styles'...
[16:04:35] Starting 'librarys'...
[16:04:35] Starting 'assets'...
[16:04:35] Starting 'scripts'...
[16:04:35] gulp-notify: [Error running Gulp] File not found with singular glob: C:\Users\КузяАсер\Downloads\OpenServer\domains\potokblue\frontend\styles\main2.css
[16:04:36] assets frontend\assets
[16:04:36] assets frontend\assets\fonts
[16:04:36] assets frontend\assets\img
[16:04:37] assets frontend\assets\index.html
[16:04:37] assets frontend\assets\js
[16:04:37] assets frontend\assets\fonts\font-awesome
[16:04:45] assets frontend\assets\js\gnmenu.js
[16:04:45] assets frontend\assets\js\lib
[16:04:45] assets frontend\assets\fonts\font-awesome\css
[16:04:45] assets frontend\assets\fonts\font-awesome\fonts
[16:04:45] assets frontend\assets\fonts\font-awesome\HELP-US-OUT.txt
[16:04:45] assets frontend\assets\fonts\font-awesome\less
[16:04:45] assets frontend\assets\fonts\font-awesome\scss
[16:04:45] assets frontend\assets\js\lib\bootstrap.min.js
[16:04:45] assets frontend\assets\js\lib\jquery-1.12.4.min.js
[16:04:45] assets frontend\assets\fonts\font-awesome\fonts\fontawesome-webfont.eot
[16:04:45] assets frontend\assets\fonts\font-awesome\fonts\fontawesome-webfont.svg
[16:04:45] assets frontend\assets\fonts\font-awesome\fonts\fontawesome-webfont.ttf
[16:04:45] assets frontend\assets\fonts\font-awesome\fonts\fontawesome-webfont.woff
[16:04:45] assets frontend\assets\fonts\font-awesome\fonts\fontawesome-webfont.woff2
[16:04:45] assets frontend\assets\fonts\font-awesome\fonts\FontAwesome.otf
[16:04:45] assets frontend\assets\fonts\font-awesome\css\font-awesome.css
[16:04:45] assets frontend\assets\fonts\font-awesome\css\font-awesome.min.css
[16:04:45] assets frontend\assets\fonts\font-awesome\less\animated.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\bordered-pulled.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\core.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\fixed-width.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\font-awesome.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\icons.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\larger.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\list.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\mixins.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\path.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\rotated-flipped.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\screen-reader.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\stacked.less
[16:04:45] assets frontend\assets\fonts\font-awesome\less\variables.less
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\font-awesome.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_animated.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_bordered-pulled.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_core.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_fixed-width.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_icons.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_larger.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_list.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_mixins.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_path.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_rotated-flipped.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_screen-reader.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_stacked.scss
[16:04:45] assets frontend\assets\fonts\font-awesome\scss\_variables.scss
[16:04:45] assets 98 items
[16:04:45] Finished 'assets' after 10 s
[16:04:45] The following tasks did not complete: dev, build, <parallel>, styles
[16:04:45] Did you forget to signal async completion?
C:\OpenServer\domains\localhost\projectgulp>gulp
[16:54:39] Using gulpfile C:\OpenServer\domains\localhost\projectgulp\gulpfile.js
[16:54:39] Starting 'browser-sync'...
[16:54:39] Finished 'browser-sync' after 172 ms
[16:54:39] Starting 'less'...
[16:54:39] Starting 'scripts'...
[BS] 1 file changed (style.css)
[16:54:40] Finished 'less' after 1.05 s
[16:54:40] Starting 'css-libs'...
[16:54:40] Finished 'css-libs' after 1.89 ms
[16:54:40] Finished 'scripts' after 1.05 s
[16:54:40] Starting 'watch'...
[16:54:40] Finished 'watch' after 11 ms
[16:54:40] Starting 'default'...
[16:54:40] Finished 'default' after 1.39 μs
[BS] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.0.103:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://192.168.0.103:3001
--------------------------------------
[BS] Serving files from: app
var gulp = require('gulp'), // Подключаем Gulp
less = require('gulp-less'), //Подключаем less пакет,
browserSync = require('browser-sync'), // Подключаем Browser Sync
concat = require('gulp-concat'), // Подключаем gulp-concat (для конкатенации файлов)
uglify = require('gulp-uglifyjs'), // Подключаем gulp-uglifyjs (для сжатия JS)
cssnano = require('gulp-cssnano'), // Подключаем пакет для минификации CSS
rename = require('gulp-rename'), // Подключаем библиотеку для переименования файлов
del = require('del'), // Подключаем библиотеку для удаления файлов и папок
imagemin = require('gulp-imagemin'), // Подключаем библиотеку для работы с изображениями
// pngquant = require('imagemin-pngquant'), // Подключаем библиотеку для работы с png
// cache = require('gulp-cache'), // Подключаем библиотеку кеширования
autoprefixer = require('gulp-autoprefixer');// Подключаем библиотеку для автоматического добавления префиксов npm install gulp-uglifyjs --save-dev
var csso = require('gulp-csso'),
rigger = require('gulp-rigger'); //плагин позволяет хранить статичные части сайта, такие как header, footer, aside
gulp.task('less', function(){ // Создаем таск Less
return gulp.src('app/less/**/*.less') // Берем источник
.pipe(less()) // Преобразуем Less в CSS посредством gulp-less
.pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true })) // Создаем префиксы
.pipe(gulp.dest('app/css')) // Выгружаем результата в папку app/css
.pipe(browserSync.reload({stream: true})) // Обновляем CSS на странице при изменении
});
gulp.task('browser-sync', function() { // Создаем таск browser-sync
browserSync({ // Выполняем browserSync
server: { // Определяем параметры сервера
baseDir: 'app' // Директория для сервера - app
},
notify: false // Отключаем уведомления
});
});
gulp.task('scripts', function() {
return gulp.src([ // Берем все необходимые библиотеки
'app/libs/jquery/jquery-3.2.1.min.js'//, // Берем jQuery
// 'app/libs/magnific-popup/dist/jquery.magnific-popup.min.js' // Берем Magnific Popup
])
.pipe(concat('libs.min.js')) // Собираем их в кучу в новом файле libs.min.js
.pipe(uglify()) // Сжимаем JS файл
.pipe(gulp.dest('app/js')); // Выгружаем в папку app/js
});
gulp.task('css-libs', ['less'], function() {
return gulp.src('app/css/libs.css') // Выбираем файл для минификации
.pipe(cssnano()) // Сжимаем
.pipe(rename({suffix: '.min'})) // Добавляем суффикс .min
.pipe(gulp.dest('app/css')); // Выгружаем в папку app/css
});
gulp.task('watch', ['browser-sync', 'css-libs', 'scripts'], function() {
gulp.watch('app/less/**/*.less', ['less']); // Наблюдение за less файлами в папке less
gulp.watch('app/*.html', browserSync.reload); // Наблюдение за HTML файлами в корне проекта
gulp.watch('app/js/**/*.js', browserSync.reload); // Наблюдение за JS файлами в папке js
});
/*gulp.task('clean', function() {
return del.sync('dist'); // Удаляем папку dist перед сборкой
});*/
gulp.task('img', function() {
return gulp.src('app/img/**/*') // Берем все изображения из app
.pipe(cache(imagemin({ // Сжимаем их с наилучшими настройками с учетом кеширования
interlaced: true,
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
})))
.pipe(gulp.dest('dist/img')); // Выгружаем на продакшен
});
gulp.task('build', [/*'clean',*/ 'img', 'less', 'scripts'], function() {
var buildCss = gulp.src([ // Переносим библиотеки в продакшен
'app/css/main.css',
'app/css/libs.min.css'
])
.pipe(gulp.dest('dist/css'))
var buildFonts = gulp.src('app/fonts/**/*') // Переносим шрифты в продакшен
.pipe(gulp.dest('dist/fonts'))
var buildJs = gulp.src('app/js/**/*') // Переносим скрипты в продакшен
.pipe(gulp.dest('dist/js'))
var buildHtml = gulp.src('app/*.html') // Переносим HTML в продакшен
.pipe(gulp.dest('dist'));
});
gulp.task('clear', function (callback) {
return cache.clearAll();
})
gulp.task('default', ['watch']);
{
"name": "projectgulp",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"browser-sync": "^2.18.12",
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-cssnano": "^2.1.2",
"gulp-exit": "^0.0.2",
"gulp-grep": "^0.2.0",
"gulp-html-replace": "^1.6.2",
"gulp-imagemin": "^3.3.0",
"gulp-jsonminify": "^1.0.0",
"gulp-less": "^3.3.2",
"gulp-minify-css": "^1.2.4",
"gulp-ng-annotate": "^2.0.0",
"gulp-order": "^1.1.1",
"gulp-protractor": "^4.1.0",
"gulp-sourcemaps": "^2.6.0",
"gulp-uglifyjs": "^0.6.2",
"gulp-uglify": "^3.0.0",
"gulp-using": "^0.1.1",
"karma": "^1.7.0",
"merge-stream": "^1.0.1"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-connect": "^5.0.0",
"gulp-csso": "^3.0.0",
"gulp-jshint": "^2.0.4",
"gulp-plumber": "^1.1.0",
"gulp-rigger": "^0.5.8",
"gulp-spritesmith": "0.0.2",
"gulp-watch": "^4.3.11"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/.."
},
"author": "...",
"license": "ISC",
"bugs": {
"url": "https://github.com/.."
},
"homepage": "https://github.com/...",
"description": ""
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
//= include/header.html
<section class="content">
Далеко-далеко за словесными горами в стране, гласных и согласных живут рыбные тексты. Которой над взобравшись дорогу рыбными свой деревни, парадигматическая она сбить даль щеке! Прямо мир агенство о предложения буквенных реторический это.
<p><img src="img/1.jpg" alt="Alt"></p>
<p><img src="img/2.jpg" alt="Alt"></p>
<p><img src="img/3.jpg" alt="Alt"></p>
</section>
//= include/footer.html
<script src="js/libs.min.js"></script>
</body>
</html>
эффекта нет...