/
gulpfile.js
85 lines (79 loc) · 2.37 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
/**
* A11y Web Accessibility Web App
*
* Front-end Setup
* ===================
*
* This application uses Express and Polymer. Run `gulp`
* to fire up the watch task so you can develop and test against
* localhost on port 3000.
*
* Due to the need for us to use Vulcanize for production, while
* developing you will use localhost:3000/source.html for editing
* the application. This reads in the main elements used from the
* /components directory.
*
* To prepare the app for production, run `gulp vulcanize`. This
* will vulcanize source.html -> index.html so that Express serves
* up the optimized app at localhost:3000 / any server that the app
* gets pushed to.
*
* Front-end assets should be placed inside the public directory.
*
* Back-end Setup
* ====================
*
* As mentioned, we're using Express. app/controllers/home.js is
* where we directly use the A11y module to perform audits. It's
* also where the bulk of routing occurs. We do have Jade templates
* setup in app/views however these are mostly left behind from an
* older refactor in case we decide to provide an alternative front-end.
*
* Deployment
* ====================
*
* This application is hosted on https://a11y-api.herokuapp.com/. To
* push your work, `git push heroku master` to update. If you notice the
* build isn't working, check your heroku logs for further information.
*/
var gulp = require('gulp');
var nodemon = require('gulp-nodemon');
var livereload = require('gulp-livereload');
var sass = require('gulp-sass');
var vulcanize = require('gulp-vulcanize');
var rename = require('gulp-rename');
gulp.task('sass', function () {
gulp.src('./public/css/*.scss')
.pipe(sass())
.pipe(gulp.dest('./public/css'))
.pipe(livereload());
});
gulp.task('watch', function() {
gulp.watch('./public/css/*.scss', ['sass']);
});
gulp.task('vulcanize', function() {
var DEST_DIR = 'public';
return gulp.src('public/source.html')
.pipe(vulcanize({
dest: DEST_DIR,
strip: true
}))
.pipe(rename('index.html'))
.pipe(gulp.dest(DEST_DIR));
});
gulp.task('develop', function () {
livereload.listen();
nodemon({
script: 'app.js',
ext: 'js jade',
}).on('restart', function () {
setTimeout(function () {
livereload.changed();
}, 500);
});
});
gulp.task('default', [
'sass',
'develop',
'watch'
]);