-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
59 lines (51 loc) · 1.35 KB
/
Gulpfile.js
File metadata and controls
59 lines (51 loc) · 1.35 KB
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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var wrap = require("gulp-wrap");
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
var files = {
watch: "./src/**/*",
testWatch: "./test/*",
concat: './src/lib/*.js',
wrapper: './src/elpmisEditor.js',
destiny: './dist/elpmisEditor.min.js'
}
gulp.task('lint', function() {
gulp.src(files.concat)
.pipe(concat('elpmisEditor.js'))
.pipe(wrap({src:files.wrapper}))
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('dist', function() {
gulp.src(files.concat)
.pipe(concat('elpmisEditor.js'))
.pipe(wrap({src:files.wrapper}))
.pipe(gulp.dest('./dist'))
.pipe(rename('elpmisEditor.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist'));
});
gulp.task('test', function() {
gulp.src(files.concat)
.pipe(concat('elpmisEditor.js'))
.pipe(wrap({src:files.wrapper}))
.pipe(gulp.dest('./test'));
});
gulp.task('server', function() {
browserSync.init({
server: {
baseDir: "./test"
}
});
});
gulp.task('default', ['lint', 'dist', 'test', 'server', 'watch']);
gulp.task('reload', function(){
reload();
});
gulp.task('watch', function() {
gulp.watch([files.watch, files.testWatch], ['lint', 'dist', 'test', 'reload']);
});