-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
114 lines (101 loc) · 2.68 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var compass = require('gulp-compass');
var scsslint = require('gulp-scss-lint');
var jshint = require('gulp-jshint');
var minify = require('gulp-minify');
var shell = require('gulp-shell');
var connect = require('gulp-connect');
var theme = './awesomeconference_theme/';
var paths = {
'css': '' + theme + 'static/css/',
'js': '' + theme + 'js/',
'sass': '' + theme + 'sass/',
'templates': '' + theme + 'templates/',
'settings': './settings/',
'content': './content/',
};
var patterns = {
'sass': [
paths.sass + '*.scss',
paths.sass + '_*.scss',
paths.sass + '**/*.scss'
],
'js': [
paths.js + '*.js',
paths.js + '**/*.js',
'!' + paths.js + '*.min.js',
'!' + paths.js + '**/*.min.js'
],
'css': [
paths.css + 'screen.css'
],
'pelican': [
paths.templates + '*.html',
paths.templates + '**/*.html',
paths.content + '*.rst',
paths.content + '**/*.rst',
paths.settings + '*.py',
]
};
gulp.task('jslint', function() {
gulp.src(patterns.js)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('pelican', shell.task([
'pelican'
]));
gulp.task('jscompress', function() {
gulp.src(patterns.js)
.pipe(minify({
noSource: true,
mangle: true
}))
.pipe(gulp.dest('' + theme + 'static/js/'))
});
gulp.task('scsslint', function() {
gulp.src(patterns.sass)
.pipe(scsslint({
'config': '' + theme + 'scss-lint.yml',
}))
.on('error', function(error) {
gutil.log(error);
});
});
gulp.task('compass', function() {
gulp.src(patterns.sass)
.pipe(compass({
style: 'compressed',
comments: false,
sourcemap:true,
force: true,
css: paths.css,
sass: paths.sass
}))
.on('error', function(error) {
gutil.log(error);
});
});
gulp.task('watch', function() {
gulp.start('jslint');
gulp.start('scsslint');
gulp.start('jscompress');
gulp.start('compass');
gulp.start('pelican');
gulp.watch(patterns.js, ['jslint']);
gulp.watch(patterns.js, ['jscompress']);
gulp.watch(patterns.js, ['pelican']);
gulp.watch(patterns.pelican, ['pelican']);
gulp.watch(patterns.css, ['pelican']);
gulp.watch(patterns.sass, ['scsslint']);
gulp.watch(patterns.sass, ['compass']);
});
gulp.task('connect', function() {
connect.server({
root: 'output',
livereload: true
});
});
gulp.task('default', ['connect', 'watch']);