-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
79 lines (69 loc) · 2.17 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
76
77
78
79
'use strict';
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var csso = require('gulp-csso');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var sass = require('gulp-ruby-sass');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var cache = require('gulp-cache');
var size = require('gulp-size');
var livereload = require('gulp-livereload');
var markdown = require('gulp-markdown');
var fileinclude = require('gulp-file-include')
var es = require('event-stream');
var lr = require('tiny-lr');
var server = lr();
gulp.task('styles', function () {
gulp.src('app/styles/vendor/*.css')
.pipe(csso())
.pipe(size())
.pipe(concat('vendor.css'))
.pipe(gulp.dest('dist/styles'));
return gulp.src('app/styles/**/*.sass')
.pipe(sass({
style: 'expanded',
loadPath: ['app/bower_components']
}))
.pipe(autoprefixer('last 1 version'))
.pipe(csso())
.pipe(size())
.pipe(concat('all.css'))
.pipe(gulp.dest('dist/styles'));
});
gulp.task('scripts', function () {
return es.concat(
gulp.src('app/bower_components/jquery/jquery.min.js'),
gulp.src('app/scripts/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
)
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/scripts'));
});
gulp.task('markdown', function () {
return gulp.src(['app/**/*.md', 'app/**/*.markdown'])
.pipe(markdown())
.pipe(gulp.dest('build/markdown'));
});
gulp.task('html', ['markdown'], function () {
return gulp.src('app/*.html')
.pipe(fileinclude())
.pipe(size())
.pipe(gulp.dest('dist'));
});
gulp.task('images', function () {
return gulp.src('app/images/**/*')
.pipe(size())
.pipe(gulp.dest('dist/images'));
});
gulp.task('clean', function () {
return gulp.src(['dist'], {read: false}).pipe(clean());
});
gulp.task('build', ['markdown', 'html', 'styles', 'scripts', 'images']);
gulp.task('default', ['clean'], function () {
gulp.start('build');
});