-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
65 lines (55 loc) · 1.94 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
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload');
var dest = 'dist',
liveReloadPort = 45127;
gulp.task('styles', function() {
return gulp.src('src/**/*.scss')
.pipe(sass({style: 'expanded'}))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest(dest))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest(dest));
});
gulp.task('scripts', function() {
return gulp.src('src/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(concat('wm-responsive-table.js'))
.pipe(gulp.dest(dest))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(dest));
});
gulp.task('clean', function() {
return gulp.src([dest], {read: false})
.pipe(clean());
});
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts');
});
gulp.task('watch', function() {
gulp.watch('src/**/*.scss', ['styles']);
gulp.watch('src/**/*.js', ['scripts']);
// Create LiveReload server
var server = livereload(liveReloadPort);
// Watch any files in dist/, reload on change
gulp.watch([dest + '/**', 'examples/**/*.html']).on('change', function(file) {
server.changed(file.path);
});
});
gulp.task('server', ['default', 'watch'], function(next) {
var connect = require('connect'),
server = connect()
.use(require('connect-livereload')({ port: liveReloadPort }))
.use(connect.static('.'));
server.listen(process.env.PORT || 8080, next);
});