-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
67 lines (61 loc) · 1.53 KB
/
gulpfile.js
File metadata and controls
67 lines (61 loc) · 1.53 KB
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
var gulp = require('gulp');
var harp = require('harp')
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var deploy = require('gulp-gh-pages');
var cp = require('child_process');
/**
* Serve the Harp Site
*/
gulp.task('serve', function () {
harp.server(__dirname, {
port: 9000
}, function () {
browserSync({
proxy: "localhost:9000",
open: false,
/* Hide the notification. It gets annoying */
notify: {
styles: ['opacity: 0', 'position: absolute']
}
});
/**
* Watch for sass changes, tell BrowserSync to refresh main.css
*/
gulp.watch("public/**/*.sass", function () {
reload("main.css", {stream: true});
});
/**
* Watch for all other changes, reload the whole page
*/
gulp.watch(["public/**/*.ejs", "public/**/*.json", "public/**/*.md"], function () {
reload();
});
})
});
/**
* Serve the site in production
*/
gulp.task('production', function (done) {
cp.exec('NODE_ENV=production sudo harp server --port 80', {stdio: 'inherit'})
.on('close', done)
});
/**
* Build the Harp Site
*/
gulp.task('build', function (done) {
cp.exec('harp compile . dist', {stdio: 'inherit'})
.on('close', done)
});
/**
* Push build to gh-pages
*/
gulp.task('deploy', ['build'], function () {
return gulp.src("./dist/**/*")
.pipe(deploy())
});
/**
* Default task, running `gulp` will fire up the Harp site,
* launch BrowserSync & watch files.
*/
gulp.task('default', ['serve']);