-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
78 lines (61 loc) · 1.72 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
'use strict';
/* jshint node:true */
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var webrootPath = 'www';
var cssPath = webrootPath + '/css';
var sassPath = cssPath + '/sass';
var jsPath = webrootPath + '/js';
var jsdoxInputFolders = [
'www/js/core/AppController.js',
'www/js/core/AppRouter.js',
'www/js/core/models',
'www/js/core/singletons',
'www/js/core/utils',
'www/js/core/views',
];
var jsdoxOutputFolder = 'documentation/api';
var tinylr;
var lrPort = 35729;
var lrWatchPaths = [
cssPath + '/*.css',
jsPath + '/app/templates/*.html',
jsPath + '/app/views/*.js',
];
function notifyLiveReload(event) {
var fileName = require('path').relative(__dirname, event.path);
tinylr.changed({
body: {
files: [ fileName ]
}
});
}
gulp.task('default', ['live']);
gulp.task('live', ['livecompass', 'livereload']);
gulp.task('livereload', function () {
tinylr = require('tiny-lr')();
tinylr.listen(lrPort);
for (var i in lrWatchPaths) {
gulp.watch(lrWatchPaths[i], notifyLiveReload);
}
});
gulp.task('livecompass', function () {
gulp.watch(sassPath + '/*.scss', ['compass']);
});
gulp.task('compass', function () {
var compass = require('gulp-compass');
gulp.src(sassPath + '/*.scss')
.pipe(plumber())
.pipe(compass({
config_file: sassPath + '/config.rb',
css: cssPath,
sass: sassPath,
}))
.pipe(gulp.dest(cssPath));
});
gulp.task('jsdox', function () {
var jsdox = require('jsdox');
for (var i = 0; i < jsdoxInputFolders.length; i++) {
jsdox.generateForDir(jsdoxInputFolders[i], jsdoxOutputFolder, null, function () {});
}
});