-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold-gulpfile.js
106 lines (92 loc) · 2.86 KB
/
old-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
94
95
96
97
98
99
100
101
102
103
104
105
106
var autoprefixer = require('gulp-autoprefixer'),
cache = require('gulp-cache'),
concat = require('gulp-concat'),
browserSync = require('browser-sync'),
gulp = require('gulp'),
imagemin = require('gulp-imagemin'),
jshint = require('gulp-jshint'),
manifest = require('asset-builder')('./assets/manifest.json'),
merge = require('merge-stream'),
minifycss = require('gulp-minify-css'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
wiredep = require('wiredep'),
app = manifest.getDependencyByName('scripts.js');
gulp.task('browser-sync', function() {
browserSync.init({
proxy: manifest.config;
});
});
gulp.task('bs-reload', function () {
browserSync.reload();
});
gulp.task('bootstrap', function () {
var bsjs = gulp.src(bsJsPath + 'bootstrap.min.js')
.pipe(gulp.dest(scriptsPath));
var bsfonts = gulp.src(bsFontsPath + '*')
.pipe(gulp.dest(fontsPath))
});
gulp.task('images', function(){
gulp.src('assets/imgs/**/*')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true })))
.pipe(gulp.dest('dist/images/'))
.pipe(browserSync.reload({stream:true}));
});
/*
gulp.task('', function(){
});
*/
gulp.task('fonts', function(){
return gulp.src('assets/fonts/**/*')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(gulp.dest('dist/fonts/'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('styles', function(){
return gulp.src('assets/scss/**/*.scss')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(sass())
.pipe(gulp.dest('assets/css/'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('dist/styles/'))
.pipe(browserSync.reload({stream:true}))
});
gulp.task('scripts', function(){
return gulp.src('assets/js/**/*.js')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('scripts.js'))
.pipe(gulp.dest('assets/js/'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('dist/scripts/'))
.pipe(browserSync.reload({stream:true}))
});
gulp.task('default', ['browser-sync'], function(){
gulp.watch("assets/scss/**/*.scss", ['styles']);
gulp.watch("assets/js/**/*.js", ['scripts']);
gulp.watch("assets/imgs/**/*", ['images']);
gulp.watch("*.html", ['bs-reload']);
gulp.watch("*.php", ['bs-reload']);
});