forked from allegro/ralph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (60 loc) · 2.32 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
var gulp = require('gulp');
less = require('gulp-less'),
watch = require('gulp-watch'),
runSequence = require('run-sequence'),
rename = require('gulp-rename'),
bower = require('gulp-bower');
var config = {
bowerDir: './bower_components',
dstRoot: 'src/ralph/admin/static/'
}
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDir))
});
gulp.task('css', function() {
return gulp.src('bower_components/normalize.css/normalize.css')
.pipe(gulp.dest(config.dstRoot + '/css'));
});
gulp.task('fonts', function() {
return gulp.src('bower_components/fontawesome/fonts/*.*')
.pipe(gulp.dest(config.dstRoot + '/fonts'));
});
gulp.task('vendors', function(){
var vendorFiles = [
'./bower_components/fastclick/lib/fastclick.js',
'./bower_components/jquery.cookie/jquery.cookie.js',
'./bower_components/jquery/dist/jquery.js',
'./bower_components/modernizr/modernizr.js',
];
gulp.src(vendorFiles)
.pipe(gulp.dest(config.dstRoot + 'js/vendor'));
gulp.src('./bower_components/jquery-placeholder/jquery.placeholder.js')
.pipe(rename('placeholder.js'))
.pipe(gulp.dest(config.dstRoot + 'js/vendor'));
var angularFiles = [
'./bower_components/angular-breadcrumb/dist/angular-breadcrumb.min.js',
'./bower_components/angular-cookies/angular-cookies.min.js',
'./bower_components/angular/angular.min.js',
'./bower_components/angular-resource/angular-resource.min.js',
'./bower_components/angular-route/angular-route.min.js',
'./bower_components/angular-ui-router/release/angular-ui-router.min.js',
]
gulp.src(angularFiles)
.pipe(gulp.dest('src/ralph/dc_view/static/js/vendor'));
});
var lessDir = './src/ralph/dc_view/static/css/'
gulp.task('less', function() {
var lessFilesButNoUnderscoreAtBeginning = '[!_]*.less';
return gulp.src(lessDir + lessFilesButNoUnderscoreAtBeginning)
.pipe(less())
.on('error', console.error.bind(console))
.pipe(gulp.dest(lessDir));
});
gulp.task('watch', function() {
gulp.watch(lessDir + '*.less', ['less']);
});
gulp.task('dev', function(callback) {
runSequence('bower', 'css', 'fonts', 'vendors', 'less', callback);
});
gulp.task('default', ['dev']);