Completed
Push — master ( cc173b...1bbcf8 )
by Peter
21:26
created

gulpfile.js ➔ gulp.task(ꞌfontsꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
nc 1
nop 0
1
var gulp = require('gulp');
2
var plugins = require('gulp-load-plugins')();
3
4
var config  = {
5
    bowerDir: 'bower_components',
6
    assetsDir: 'app/Resources/assets',
7
    cssPattern: 'css/**/*.css',
8
    jsPattern: 'js/**/*.js',
9
    production: !!plugins.util.env.production
10
};
11
12
gulp.task('styles', function() {
13
    gulp.src([
14
        config.bowerDir+'/bootstrap/dist/css/bootstrap.min.css',
15
        config.assetsDir+'/'+config.cssPattern
16
    ])
17
        .pipe(plugins.if(config.production, plugins.plumber()))
18
        .pipe(config.production ? plugins.cleanCss({compatibility: 'ie8'}) : plugins.util.noop())
19
        .pipe(plugins.concat('app.css'))
20
        .pipe(gulp.dest('web/css'));
21
});
22
23
gulp.task('scripts', function() {
24
    gulp.src([
25
        config.bowerDir+'/jquery/dist/jquery.min.js',
26
        config.bowerDir+'/bootstrap/dist/js/bootstrap.min.js',
27
        config.assetsDir+'/'+config.jsPattern
28
    ])
29
        .pipe(plugins.if(config.production, plugins.plumber()))
30
        .pipe(plugins.concat('app.js'))
31
        .pipe(config.production ? plugins.uglify() : plugins.util.noop())
32
        .pipe(gulp.dest('web/js'));
33
});
34
35
gulp.task('fonts', function() {
36
    gulp.src([
37
        config.bowerDir+'/bootstrap/dist/fonts/glyphicons-halflings-regular*'
38
    ])
39
        .pipe(gulp.dest('web/fonts'));
40
});
41
42
gulp.task('watch', function() {
43
    gulp.watch(config.assetsDir+'/'+config.cssPattern, ['styles']);
44
    gulp.watch(config.assetsDir+'/'+config.jsPattern, ['scripts']);
45
});
46
47
gulp.task('default', ['styles', 'scripts', 'fonts', 'watch']);
48