forked from auth0/styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
93 lines (83 loc) · 2.49 KB
/
Copy pathgulpfile.js
File metadata and controls
93 lines (83 loc) · 2.49 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const gulp = require('gulp');
const server = require('gulp-server-livereload');
const jade = require('gulp-jade');
const stylus = require('gulp-stylus');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const cssmin = require('gulp-cssmin');
const rename = require('gulp-rename');
gulp.task('server', ['build'], function() {
return gulp.src('./build/')
.pipe(server({
livereload: true,
open: true
}));
});
gulp.task('copy', function() {
gulp.src('./package.json')
.pipe(gulp.dest('./build/landing/'));
gulp.src('./landing/**/*.js')
.pipe(gulp.dest('./build/landing/'));
return gulp.src('./lib/**/*.*')
.pipe(gulp.dest('./build/lib/'));
});
gulp.task('stylus-landing', function() {
return gulp.src('./landing/styles/*.styl')
.pipe(sourcemaps.init())
.pipe(stylus({
'include css': true
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./build/'))
});
gulp.task('stylus-lib', function() {
return gulp.src('index.styl')
.pipe(sourcemaps.init())
.pipe(stylus({
'include css': true
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./build/'))
});
gulp.task('jade-lib', function() {
return gulp.src('./lib/**/*.jade')
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest('./build/landing/html/'))
});
gulp.task('jade-landing', function() {
gulp.src('./landing/index.jade')
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest('./build/'))
return gulp.src('./landing/stage/index.jade')
.pipe(jade())
.pipe(gulp.dest('./build/stage/'))
});
gulp.task('cssmin', ['stylus-lib', 'stylus-landing'], function() {
return gulp.src(['build/**/*.css', '!build/**/*.min.css'])
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('build'))
});
gulp.task('watch', function() {
gulp.watch(['./lib/**/*.jade'], ['templates', 'copy']);
gulp.watch(['./landing/**/*.jade', './landing/**/*.js'], ['jade-landing', 'copy']);
gulp.watch(['./lib/**/*.styl'], ['css']);
gulp.watch(['./landing/**/*.styl'], ['css']);
});
gulp.task('templates', ['jade-landing', 'jade-lib']);
gulp.task('stylus', ['stylus-landing', 'stylus-lib']);
gulp.task('css', ['stylus', 'cssmin']);
gulp.task('build', ['css', 'templates', 'copy']);
gulp.task('default', ['server', 'build', 'watch']);