This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (60 loc) · 2.16 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
'use strict';
var gulp = require('gulp')
var plugins = {
gutil: require('gulp-util'),
concat: require('gulp-concat'),
autoprefixer: require('gulp-autoprefixer'),
watch: require('gulp-watch'),
plumber: require('gulp-plumber'),
less: require('gulp-less'),
browserify: require('browserify'),
exorcist: require('exorcist'),
watchify: require('watchify'),
jadeify: require('jadeify'),
rm: require('rimraf'),
source: require('vinyl-source-stream'),
transform: require('vinyl-transform')
}
gulp.configs = {
isProduction: plugins.gutil.env.dev ? false : true,
sourceMap: plugins.gutil.env.dev ? true : false
}
// Sources
var sources = {}
sources.less = "src/**/*.less"
sources.docs = "src/**/*.jade"
sources.js = "src/**/*.js"
sources.root = {};
sources.root.docs = "src/index.jade"
sources.root.js = "./src/app.js"
sources.styles = {}
sources.styles.build = 'src/styles/bootstrap-build.less'
sources.styles.root = 'src/styles/'
sources.assets = {}
sources.assets.fonts = ['src/assets/fonts/*', 'node_modules/font-awesome/fonts/**']
sources.assets.images = 'src/media/**/*'
// Destinations
var destinations = {}
destinations.root = 'dist/'
destinations.docs = destinations.root
destinations.js = destinations.root
destinations.styles = destinations.root + 'styles/'
destinations.assets = {}
destinations.assets.fonts = destinations.root + 'fonts/'
destinations.assets.images = destinations.root + 'media/'
// build and watch tasks, the file name is self explaining
require('./gulp/utils')(gulp, plugins, sources, destinations)
require('./gulp/less')(gulp, plugins, sources, destinations)
require('./gulp/jade')(gulp, plugins, sources, destinations)
require('./gulp/assets')(gulp, plugins, sources, destinations)
require('./gulp/browserify')(gulp, plugins, sources, destinations)
// Main trigger with dev switch
gulp.task('default', ['clean'], function () {
gulp.configs.isProduction ? gulp.start('app:build') : gulp.start('app:dev')
})
gulp.task('app:build', function () {
gulp.start(['jade:build', 'browserify:build', 'less:build', 'assets:build'])
})
gulp.task('app:dev', function () {
gulp.start(['jade:watch', 'browserify:watch', 'less:watch', 'assets:watch'])
})