forked from literallycanvas/literallycanvas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (56 loc) · 1.72 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
var browserify = require('browserify');
var gulp = require('gulp');
var connect = require('gulp-connect');
var rename = require('gulp-rename');
var sass = require('gulp-ruby-sass');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify')
var uglify = require('gulp-uglify');
gulp.task('sass', function() {
return gulp.src('scss/literallycanvas.scss')
.pipe(sass({ style: 'compressed' }))
.pipe(gulp.dest('lib/css'))
.pipe(connect.reload())
});
gulp.task('browserify', function() {
var bundleStream = browserify({
basedir: 'src', extensions: ['.js', '.coffee'], debug: true
}).add('./index.coffee')
.external('React/addons')
.external('React')
.transform('coffeeify')
.bundle({standalone: 'LC'})
.on('error', function (err) {
if (err) {
console.error(err.toString());
}
});
return bundleStream
.pipe(source('./src/index.coffee'))
.pipe(rename('literallycanvas.js'))
.pipe(gulp.dest('./lib/js/'))
.pipe(connect.reload());
});
gulp.task('uglify', ['browserify'], function() {
return gulp.src('./lib/js/literallycanvas.js')
.pipe(uglify())
.pipe(rename('literallycanvas.min.js'))
.pipe(gulp.dest('./lib/js'));
});
gulp.task('default', ['uglify', 'sass'], function() {
});
gulp.task('demo-reload', function () {
return gulp.src('demo/*').pipe(connect.reload());
});
gulp.task('watch', function() {
gulp.watch(['src/*.coffee', 'src/*/*.coffee'], ['browserify']);
gulp.watch('scss/*.scss', ['sass']);
gulp.watch('demo/*', ['demo-reload']);
});
gulp.task('serve', function() {
connect.server({
livereload: {port: 35728}
});
});
gulp.task('dev', ['browserify', 'sass', 'watch', 'serve'], function() {
});