var gulp = require('gulp'),
gutil = require('gulp-util' ),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
cleanCSS = require('gulp-clean-css'),
rename = require('gulp-rename'),
del = require('del'),
imagemin = require('gulp-imagemin'),
cache = require('gulp-cache'),
autoprefixer = require('gulp-autoprefixer'),
ftp = require('vinyl-ftp'),
notify = require("gulp-notify"),
rsync = require('gulp-rsync');
gulp.task('common-js', function() {
return gulp.src([
'src/js/common.js',
])
.pipe(concat('common.js'))
//.pipe(uglify())
.pipe(gulp.dest('local/templates/vertikal/js/'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('js', function() {
return gulp.src([
'src/libs/superfish/dist/js/superfish.min.js',
'src/libs/jQuery.mmenu/dist/jquery.mmenu.all.js',
'src/libs/jQuery.mmenu/dist/addons/fixedelements/jquery.mmenu.fixedelements.js',
'src/libs/magnific-popup/dist/jquery.magnific-popup.min.js',
'src/libs/owl.carousel/dist/owl.carousel.min.js',
'src/libs/phone_mask.js',
])
.pipe(concat('scripts.js'))
// .pipe(uglify())
.pipe(gulp.dest('local/templates/vertikal/js/'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('browser-sync', function() {
browserSync({
proxy: 'dev.paradigma-ekb.ru',
notify: false,
});
});
gulp.task('sass', function() {
return gulp.src('src/sass/**/*.sass')
.pipe(sass({outputStyle: 'expand'}).on("error", notify.onError()))
.pipe(rename({suffix: '', prefix : ''}))
.pipe(autoprefixer(['last 15 versions']))
.pipe(cleanCSS())
.pipe(gulp.dest('local/templates/vertikal/'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('header_style', function() {
return gulp.src('src/sass/header.sass')
.pipe(sass({outputStyle: 'expand'}).on("error", notify.onError()))
.pipe(rename({suffix: '', prefix : ''}))
.pipe(autoprefixer(['last 15 versions']))
.pipe(cleanCSS())
.pipe(gulp.dest('local/templates/vertikal/css/'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('watch', ['sass', 'js', 'common-js', 'browser-sync'], function() {
gulp.watch('src/sass/**/*.sass', ['sass']);
gulp.watch(['src/libs/**/*.js', 'src/js/common.js'], ['js']);
gulp.watch('**/*.php', browserSync.reload);
});
gulp.task('imagemin', function() {
return gulp.src('src/img/**/*')
.pipe(cache(imagemin()))
.pipe(gulp.dest('local/templates/vertikal/images'));
});
gulp.task('default', ['watch']);