forked from allegro/ralph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
93 lines (81 loc) · 3.08 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
81
82
83
84
85
86
87
88
89
90
91
92
93
var gulp = require('gulp');
watch = require('gulp-watch'),
runSequence = require('run-sequence'),
rename = require('gulp-rename'),
bower = require('gulp-bower'),
prefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
qunit = require('node-qunit-phantomjs');
var config = {
bowerDir: './bower_components/',
srcRoot: 'src/ralph/static/src/',
staticRoot: 'src/ralph/static/',
vendorRoot: 'src/ralph/static/vendor/'
}
var sass_config = {
includePaths: [
config.bowerDir + 'foundation/scss',
config.bowerDir + 'fontawesome/scss',
]
}
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDir))
});
gulp.task('scss', function() {
gulp.src(config.srcRoot + 'scss/*.scss')
.pipe(sass(sass_config).on('error', sass.logError))
.pipe(prefixer())
.pipe(gulp.dest(config.staticRoot + 'css/'))
});
gulp.task('css', function() {
var vendorFiles = [
'bower_components/normalize.css/normalize.css',
'bower_components/foundation-datepicker/stylesheets/foundation-datepicker.css',
'bower_components/angular-loading-bar/build/loading-bar.min.css',
];
return gulp.src(vendorFiles)
.pipe(gulp.dest(config.vendorRoot + 'css/'));
});
gulp.task('fonts', function() {
return gulp.src('bower_components/fontawesome/fonts/*.*')
.pipe(gulp.dest(config.vendorRoot + 'fonts/'));
});
gulp.task('js', 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',
'./bower_components/foundation/js/foundation.min.js',
'./bower_components/foundation-datepicker/js/foundation-datepicker.js',
'./bower_components/angular-loading-bar/build/loading-bar.min.js',
];
gulp.src(vendorFiles)
.pipe(gulp.dest(config.vendorRoot + 'js/'));
gulp.src('./bower_components/jquery-placeholder/jquery.placeholder.js')
.pipe(rename('placeholder.js'))
.pipe(gulp.dest(config.vendorRoot + 'js'));
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(config.vendorRoot + 'js'));
});
gulp.task('test', function() {
qunit('./src/ralph/js_tests/test_runner.html', {}, function(code) {
process.exit(code);
});
});
gulp.task('watch', function() {
gulp.watch(config.srcRoot + 'scss/**/*.scss', ['scss']);
});
gulp.task('dev', function(callback) {
runSequence('bower', 'css', 'fonts', 'js', 'scss', callback);
});
gulp.task('default', ['dev']);