-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
53 lines (45 loc) · 1.29 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
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var path = require('path');
gulp.task('copyDemo', function() {
return gulp.src('./dist/**')
.pipe(gulp.dest('./demo/libs'));
});
gulp.task('copyDist', function() {
return gulp.src('./src/d-splitter.js')
.pipe(gulp.dest('./dist/'));
});
gulp.task('demo', ['copyDemo'], function() {
var webserver = require('gulp-webserver');
return gulp.src('./demo/')
.pipe(webserver({
host: '0.0.0.0',
port: 8080,
livereload: false,
directoryListing: false,
open: false
}));
});
gulp.task('dist', ['copyDist', 'less'], function() {
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var rename = require('gulp-rename');
return gulp.src('./dist/d-splitter.js')
.pipe(sourcemaps.init())
.pipe(rename({
basename: 'd-splitter.min'
}))
.pipe(uglify())
.pipe(sourcemaps.write('./', {
sourceRoot: '.'
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('less', function () {
return gulp.src('./src/*.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(gulp.dest('./dist/css'));
});