forked from JoseTomasTocino/mindmapit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
61 lines (53 loc) · 1.57 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
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var util = require('gulp-util');
var buffer = require('vinyl-buffer');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var webserver = require('gulp-webserver');
var connect = require('gulp-connect');
var babel = require('gulp-babel');
var autoprefixer = require('gulp-autoprefixer');
var sourceFolder = './src';
var sassFolder = sourceFolder + '/scss';
var jsFolder = sourceFolder + '/js';
gulp.task('sass', function () {
gulp.src(sassFolder + '/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(concat('style.css'))
.pipe(gulp.dest('./dist/'))
.pipe(connect.reload())
;
});
gulp.task('html', function () {
gulp.src('index.html')
.pipe(connect.reload())
;
});
gulp.task('js', function () {
browserify(sourceFolder + "/app.js", {debug: true})
.transform(babelify)
.bundle()
.pipe(source("app.js"))
.pipe(gulp.dest('./dist'))
.pipe(connect.reload())
;
})
gulp.task('watch', function () {
gulp.watch('index.html', ['html']);
gulp.watch(sassFolder + '/**/*.scss', ['sass']);
gulp.watch(sourceFolder + '/**/*.js', ['js']);
});
gulp.task('connect', function () {
connect.server({
root: '.',
livereload: true
});
});
gulp.task('default', ['connect', 'watch']);