-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgulpfile.js
56 lines (49 loc) · 1.73 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
var gulp = require("gulp");
var coffee = require("gulp-coffee");
var include = require("gulp-include");
var rev = require('gulp-rev');
var gulpif = require('gulp-if');
var sass = require("gulp-sass");
var uglify = require("gulp-uglify");
var minify = require("gulp-minify-css");
var shell = require('gulp-shell');
var dotenv = require('dotenv');
var assets = [
'assets/javascripts/application.coffee',
'assets/stylesheets/application.scss'
]
// Development
// -----------------------------------------------------------
gulp.task("assets:compile", function() {
gulp.src(assets)
.pipe(include())
.pipe(gulpif('*.coffee', coffee({bare: true})))
.pipe(gulpif('*.scss', sass()))
.pipe(gulp.dest("public/assets"))
.pipe(rev())
.pipe(gulp.dest("public/assets")) // file with digest
.pipe(rev.manifest({path: 'manifest.json'}))
.pipe(gulp.dest("public/assets")) // manifest.json
});
gulp.task("server", ["assets:compile"], function() {
gulp.src('').pipe(shell('gin main.go'));
gulp.watch(['app/assets/**/*.coffee', 'app/assets/**/*.scss'], ["assets:compile"]);
});
gulp.task("test", ["assets:compile"], function() {
gulp.src('').pipe(shell('ginkgo -r'));
});
// Production
// -----------------------------------------------------------
gulp.task("assets:precompile", function() {
gulp.src(assets)
.pipe(include())
.pipe(gulpif('*.coffee', coffee({bare: true})))
.pipe(gulpif('*.scss', sass()))
.pipe(gulpif('*.css', minify()))
.pipe(gulpif('*.js', uglify()))
.pipe(gulp.dest("public/assets")) // file without digest
.pipe(rev())
.pipe(gulp.dest("public/assets")) // file with digest
.pipe(rev.manifest({path: 'manifest.json'}))
.pipe(gulp.dest("public/assets")) // manifest.json
});