-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgulpfile.js
61 lines (54 loc) · 1.42 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
var pkg = require('./package.json'),
pug = require('gulp-pug'),
gulp = require('gulp'),
less = require('gulp-less'),
clean = require('gulp-clean-css'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
header = require('gulp-header'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish');
var banner = ['/**',
' * Vanilla JavaScript Accordion v<%= pkg.version %>',
' * <%= pkg.homepage %>',
' */',
''].join('\n');
gulp.task('script', function() {
gulp.src(['./src/javascript/vanilla-js-accordion.js'])
.pipe(uglify())
.pipe(header(banner, {
pkg: pkg
}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./docs/javascript'));
});
gulp.task('markup', function() {
gulp.src('./src/index.pug')
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest('./dist'));
});
gulp.task('styles', function() {
gulp.src('./src/styles/*.less')
.pipe(less())
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./docs/styles'));
});
gulp.task('docs-styles', function() {
gulp.src('./docs/styles/*.less')
.pipe(less())
.pipe(clean({
compatibility: 'ie9'
}))
.pipe(gulp.dest('./docs/styles'));
});
gulp.task('lint', function() {
return gulp.src('./src/javascript/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(stylish));
});
gulp.task('default', [ 'script', 'markup', 'styles', 'docs-styles', 'lint' ]);