forked from PlatfoneInc/platfoneLite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
92 lines (74 loc) · 1.9 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
86
87
88
89
90
91
92
'use strict';
var gulp = require('gulp'),
del = require('del'),
sass = require('gulp-sass'),
maps = require('gulp-sourcemaps'),
swig = require('gulp-swig'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber'),
watch = require('gulp-watch'),
webserver = require('gulp-webserver');
var opt = {
'src': './',
'view': './views',
'sass': './scss',
'font': './scss/fonts',
'img' : './images',
'dist': './public'
};
var scripts = [
'./app.js',
'./directives/**.js'
];
gulp.task("concatScripts", function () {
return gulp.src(scripts)
.pipe(maps.init({loadMaps: true}))
.pipe(concat('app.js'))
.pipe(maps.write())
.pipe(gulp.dest(opt.dist + '/js'));
});
gulp.task('access', function (){
gulp.src(opt.font + '/**.**')
.pipe(gulp.dest(opt.dist + '/css/fonts'));
gulp.src(opt.img + '/**', { base: './'})
.pipe(gulp.dest(opt.dist));
});
gulp.task('view', function (){
return gulp.src(opt.view + '/*.html')
.pipe(plumber())
.pipe(swig())
.pipe(gulp.dest(opt.dist));
});
gulp.task('sass', ['access'], function (){
return gulp.src(opt.sass + '/style.scss')
.pipe(plumber())
.pipe(maps.init({loadMaps: true}))
.pipe(sass({
outputStyle: 'nested',
debug : true
}).on('error', sass.logError))
.pipe(maps.write('./')) //this path is going to be relative to our output directory ??
.pipe(gulp.dest(opt.dist + '/css'));
});
watch([opt.sass + '/**/*.scss'], function() {
gulp.start('sass');
});
watch([opt.view + '/**/*.html'], function (){
gulp.start('view');
});
gulp.task('webserver', function() {
gulp.src(opt.dist)
.pipe(webserver({
livereload: true,
open: false,
port: 3000
}));
});
gulp.task('clean', function (){
del(opt.dist);
});
gulp.task('build',['sass', 'view'], function (){
});
gulp.task('default', function (){
gulp.start('webserver','build');
});