This repository has been archived by the owner on Jan 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
84 lines (74 loc) · 2.11 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
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var postcss = require('gulp-postcss');
var jade = require('gulp-jade');
var concat = require('gulp-concat');
var livereload = require('gulp-livereload');
var sourcemaps = require('gulp-sourcemaps');
var nano = require('gulp-cssnano');
var uglify = require('gulp-uglify');
var autoprefixer = require('autoprefixer');
var tinylr = require('tiny-lr');
var express = require('express');
var path = require('path');
var app = express();
var server = tinylr();
// --- Basic Tasks ---
gulp.task('css', function () {
return gulp.src('src/css/*.scss')
.pipe(sourcemaps.init())
.pipe(
sass({
includePaths: ['src/css'],
errLogToConsole: true
}))
.pipe(postcss([
autoprefixer()
]))
.pipe(nano())
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('public/css/'))
.pipe(livereload(server));
});
gulp.task('js', function () {
return gulp.src('src/js/*.js')
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('opm.min.js'))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('public/js/'))
.pipe(livereload(server));
});
gulp.task('templates', function () {
return gulp.src('src/*.jade')
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest('public/'))
.pipe(livereload(server));
});
gulp.task('express', function () {
app.use(express.static(path.resolve('./public')));
app.listen(1337);
gutil.log('Listening on port: 1337');
});
gulp.task('static', function () {
return gulp.src('src/web-determinations/staticresource/**/*')
.pipe(gulp.dest('public/web-determinations/staticresource/'));
});
gulp.task('watch', function () {
server.listen(35729, function (err) {
if (err) {
return console.log(err);
}
gulp.watch('src/css/*.scss', ['css']);
gulp.watch('src/js/*.js', ['js']);
gulp.watch('src/**/*.jade', ['templates']);
});
});
// Default Build
gulp.task('build', ['js', 'css', 'templates', 'static']);
// Default Task
gulp.task('default', ['js', 'css', 'templates', 'static', 'express', 'watch']);