forked from Dimox/jQueryFormStyler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
71 lines (64 loc) · 1.91 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
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
browserSync = require('browser-sync').create(),
csscomb = require('gulp-csscomb'),
header = require('gulp-header'),
notify = require('gulp-notify'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
stylus = require('gulp-stylus'),
uglify = require('gulp-uglify');
gulp.task('default:dist', ['stylus:dist']);
gulp.task('default:test', ['stylus:test', 'webserver:test']);
var pkg = require('./package.json');
var head = ['/* jQuery Form Styler v<%= pkg.version %> | (c) Dimox | https://github.com/Dimox/jQueryFormStyler */\n'];
var path = {
test: '../test/',
dist: 'dist/',
src: {
js: 'dist/jquery.formstyler.js',
style: 'src/*.styl',
},
};
gulp.task('minify-js', function() {
gulp.src(path.src.js)
.pipe(uglify())
.pipe(header(head, {pkg}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(path.dist));
});
gulp.task('stylus:dist', function() {
gulp.src(path.src.style)
.pipe(plumber({errorHandler: notify.onError("Ошибка: <%= error.message %>")}))
.pipe(stylus())
.pipe(autoprefixer({
browsers: ['last 2 versions', 'ie 10', 'Safari 7']
}))
.pipe(csscomb())
.pipe(gulp.dest(path.dist))
.pipe(browserSync.stream())
;
});
gulp.task('stylus:test', function() {
gulp.src(path.src.style)
.pipe(plumber({errorHandler: notify.onError("Ошибка: <%= error.message %>")}))
.pipe(stylus())
.pipe(autoprefixer({
browsers: ['last 2 versions', 'ie 10', 'Safari 7']
}))
.pipe(csscomb())
.pipe(gulp.dest(path.test))
.pipe(browserSync.stream())
;
});
gulp.task('webserver:test', ['watch:test'], function() {
browserSync.init({
server: {
baseDir: path.test
},
scrollProportionally: false,
});
});
gulp.task('watch:test', function() {
browserSync.watch(path.src.style).on('change', function () { gulp.start('stylus:test'); });
});