-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
65 lines (59 loc) · 2.71 KB
/
gulpfile.js
File metadata and controls
65 lines (59 loc) · 2.71 KB
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
var gulp = require('gulp');
var gulpMerge = require('gulp-merge');
var sass = require('gulp-sass');
var notify = require('gulp-notify');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var imageop = require('gulp-image-optimization');
var livereload = require('gulp-livereload');
var clean = require('gulp-clean');
gulp.task('default', function() {
gulp.watch( './styles/**/*.scss', ['css-prod']);
gulp.watch( './js/**/*.js', ['js-prod']);
gulp.watch( './img/*', ['img-prod']);
});
gulp.task('fonts-prod', function () {
var g = gulp.src('./fonts/*')
.pipe(gulp.dest( './dist/fonts'));
return g;
});
gulp.task('img-prod', function(cb) {
gulp.src(['./img/**/*.png','./img/**/*.jpg','./img/**/*.gif','./img/**/*.jpeg']).pipe(imageop({
optimizationLevel: 5,
progressive: true,
interlaced: true
})).pipe(gulp.dest('./dist/img')).on('end', cb).on('error', cb);
});
gulp.task('css-prod', function () {
return gulpMerge(
gulp.src(['./styles/animate.min.css', './bower_components/bootstrap/dist/css/bootstrap.min.css', './bower_components/photoswipe/dist/photoswipe.css', './bower_components/photoswipe/dist/default-skin/default-skin.css', './styles/style.scss'])
.pipe(concat('style.scss'))
.pipe(gulp.dest('./dist/css'))
.pipe(notify({ message: 'style.scss created' }))
)
.pipe(sass({outputStyle: 'compressed'}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/css'))
.pipe(notify({ message: 'style.css created'}));
});
gulp.task('js-prod', function() {
return gulpMerge(
gulp.src(['./bower_components/jquery/dist/jquery.js', './bower_components/bootstrap/dist/js/bootstrap.min.js', './bower_components/angular/angular.js', './bower_components/angular-route/angular-route.js', './bower_components/photoswipe/dist/photoswipe.js', './bower_components/photoswipe/dist/photoswipe-ui-default.js', './bower_components/enscroll/js/mylibs/enscroll.js'])
.pipe(concat('libs.js'))
.pipe(gulp.dest( './dist/js'))
.pipe(notify({ message: 'libs.js created'})),
gulp.src('./js/**/*.js')
.pipe(concat('main.js'))
.pipe(gulp.dest( './dist/js'))
.pipe(notify({ message: 'main.js created'}))
)
.pipe(concat('app.js'))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest( './dist/js'))
.pipe(notify({ message: 'app.min.js created'}));
});
gulp.task('build', ['img-prod', 'fonts-prod', 'css-prod', 'js-prod'], function () {
gulp.src(['dist/js/*.js', 'dist/css/*.scss', '!dist/js/*min.js'], {read: false})
.pipe(clean());
});