-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgulpfile.js
81 lines (70 loc) · 1.91 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
74
75
76
77
78
79
80
'use strict';
var gulp = require('gulp');
var rjs = require('gulp-requirejs');
var uglify = require('gulp-uglify');
var devMode = process.env['NPM_CONFIG_PRODUCTION'] != 'true';
if (devMode) {
var refresh = require('gulp-livereload');
var livereload = require('tiny-lr');
var server = livereload();
gulp.task('livereload', function () {
server.listen(35729, function (err) {
if (err) { return console.log(err); }
});
});
gulp.task('css', function () {
gulp.src('app/**/*.css').pipe(refresh(server));
});
gulp.task('js', function () {
gulp.src('app/**/*.js').pipe(refresh(server));
});
gulp.task('default', function () {
gulp.run('livereload');
gulp.watch('app/**/*.css', function (event) {
gulp.run('css');
});
gulp.watch('app/**/*.js', function (event) {
gulp.run('js');
});
});
}
gulp.task('rjs', function() {
rjs({
paths: {
underscore: "../bower_components/underscore/underscore",
jquery: "../bower_components/jquery/dist/jquery",
jqueryUI: "../bower_components/jquery-ui/jquery-ui",
tipsy: "../bower_components/tipsy/src/javascripts/jquery.tipsy",
hogan: "../bower_components/hogan",
flight: "../bower_components/flight",
blockUI: "../bower_components/blockui/jquery.blockUI",
bootstrap: "../bower_components/components-bootstrap/js/bootstrap",
config: 'config',
component: 'component',
page: 'page'
},
shim: {
backbone: {
deps: ["jquery", "underscore"],
exports: "Backbone"
},
bootstrap: {
deps: ["jquery"]
},
jqueryUI: {
deps: ["jquery"],
exports: "jQuery"
},
underscore: {
exports: "_"
}
},
mainConfigFile : "app/js/main.js",
baseUrl : "app/js",
name: "main",
out: "app/dist/main.js",
removeCombined: true
})
.pipe(uglify())
.pipe(gulp.dest('.'));
});