-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
75 lines (63 loc) · 2.07 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'use strict';
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const scss = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const rename = require("gulp-rename");
const del = require('del');
const uglify = require("gulp-uglify");
const cssnano = require('gulp-cssnano');
const headerComment = require('gulp-header-comment');
const headerInfo = `
jQuery.sendMail
Version: 2.0.5
Repo: https://github.com/WahaWaher/sendmail-js
Author: Sergey Kravchenko
Contacts: wahawaher@gmail.com
License: MIT
`;
// BrowserSync
gulp.task('browser-sync', function() {
browserSync.init({
proxy: 'sendmail.js',
notify: false,
browser: 'chrome'
});
});
// Препроцессор SCSS + автопрефиксер
gulp.task('scss', function() {
return gulp.src('demo/scss/**/*.scss')
.pipe(scss({
outputStyle: "expanded",
indentType: "tab",
indentWidth: 1
})).pipe(autoprefixer({
browsers: ['last 30 versions', '> 0.5%', 'ie 9-11'], // github.com/ai/browserslist#queries
}))
.pipe(gulp.dest('demo/css'))
.pipe(browserSync.stream())
});
gulp.task('default', ['browser-sync', 'scss'], function() {
gulp.watch('demo/scss/**/*.scss', ['scss']);
gulp.watch('demo/**/*.js').on('change', browserSync.reload);
gulp.watch('demo/**/*.+(html|php)').on('change', browserSync.reload);
});
gulp.task('build', ['deldist', 'scss'], function() {
gulp.src([
'demo/js/jquery.sendmail.js'
])
.pipe(headerComment(headerInfo))
.pipe(gulp.dest('dist'));
gulp.src('demo/js/jquery.sendmail.js')
.pipe(uglify())
.pipe(headerComment(headerInfo))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('dist'));
gulp.src(['demo/mail/sendmail.php']).pipe(gulp.dest('dist/mail'));
gulp.src(['demo/mail/error.html']).pipe(gulp.dest('dist/mail'));
gulp.src(['demo/mail/success.html']).pipe(gulp.dest('dist/mail'));
gulp.src(['demo/mail/phpmailer/**/*']).pipe(gulp.dest('dist/mail/phpmailer'));
});
gulp.task('deldist', function() {
return del.sync('dist');
});