forked from PtrTn/ishetkutweerv2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (60 loc) · 2.11 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');
var notify = require("gulp-notify");
var sass = require('gulp-sass');
var merge = require('merge-stream');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
gulp.task('default', ['styles', 'scripts', 'scripts-vendor', 'fonts']);
gulp.task('scripts', function() {
return gulp.src('app/resources/js/**/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(concat('scripts.js'))
.pipe(gulp.dest('public/scripts/'))
.pipe(notify({message: 'Scripts task complete'}));
});
gulp.task('scripts-vendor', function() {
return gulp.src([
'bower_components/angular/angular.min.js',
'bower_components/jquery/dist/jquery.min.js',
'bower_components/angular-timeago/dist/angular-timeago.min.js'
])
.pipe(plumber())
.pipe(concat('vendor.js'))
.pipe(gulp.dest('public/scripts'))
.pipe(notify({message: 'Vendor task complete'}));
});
gulp.task('styles', function () {
// Compile scss
var scssStream = gulp.src('app/resources/scss/main.scss')
.pipe(sass().on('error', sass.logError));
// Retrieve css
var cssStream = gulp.src('app/resources/css/**/*.css')
.pipe(concat('css.css'));
// Merge vendor css aswell
var vendorCssStream = gulp.src(
'bower_components/font-awesome/css/font-awesome.min.css')
.pipe(concat('vendor.css'));
// Merge scss and css into styles.css
return merge(scssStream, cssStream, vendorCssStream)
.pipe(concat('styles.css'))
.pipe(gulp.dest('public/styles'))
.pipe(notify({message: 'Styles task complete'}));
});
// Copy fonts to public/fonts
gulp.task('fonts', function() {
return gulp.src([
'app/resources/fonts/**',
'bower_components/font-awesome/fonts/**'
])
.pipe(gulp.dest('public/fonts/'));
});
gulp.task('watch', function () {
gulp.start('default');
gulp.watch('app/resources/js/**/*.js', ['scripts']);
gulp.watch([
'app/resources/scss/**/*.scss',
'app/resources/css/**/*.css'
], ['styles']);
});