forked from niant/once
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (58 loc) · 1.56 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var sass = require('gulp-ruby-sass');
var prefix = require('gulp-autoprefixer');
var styledocco = require('gulp-styledocco');
var minifyCSS = require('gulp-minify-css');
var rename = require('gulp-rename');
var rimraf = require('rimraf');
gulp.task('clean', function (cb) {
rimraf('dist', cb);
});
gulp.task('jslint', function() {
return gulp.src('gulpfile.js')
.pipe(jshint())
.pipe(jshint.reporter('default')
);
});
gulp.task('sass', function() {
return gulp.src('src/sass/main.scss')
.pipe(sass())
.pipe(prefix('last 1 version', '> 1%'))
.pipe(gulp.dest('dist/css')
);
});
gulp.task('build-min', function () {
return gulp.src('src/sass/main.scss')
.pipe(sass())
.pipe(prefix('last 1 version', '> 1%'))
.pipe(minifyCSS())
.pipe(rename('main.min.css'))
.pipe(gulp.dest('dist/css'));
});
gulp.task('documentation', function() {
return gulp.src('src/sass/*.scss')
.pipe(styledocco({
verbose: true,
out: 'docs',
name: 'Once'
})
);
});
gulp.task('watch', function() {
gulp.watch('gulpfile.js', ['jslint']);
gulp.watch('src/sass/**/*.scss', ['sass']);
gulp.watch('src/sass/**/*.scss', ['documentation']);
});
gulp.task('runbuild', ['jslint', 'sass', 'build-min'], function () {
gulp.start('documentation');
});
gulp.task('build', ['clean'], function () {
gulp.start('runbuild');
});
gulp.task('dev', ['jslint', 'sass', 'watch'], function () {
gulp.start('documentation');
});
gulp.task('default', ['clean'], function () {
gulp.start('dev');
});