-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
81 lines (72 loc) · 2.37 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
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
include = require('gulp-include'),
minifyCSS = require('gulp-minify-css'),
mqpacker = require('gulp-combine-media-queries'),
imageOptim = require('gulp-imageoptim'),
gutil = require('gulp-util'),
fs = require('fs'),
ftp = require('gulp-ftp'),
package = require('./package.json');
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
gulp.task('css', function () {
return gulp.src('sass/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest('./'))
.pipe(minifyCSS())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('admincss', function () {
return gulp.src('sass/admin.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer('last 2 version'))
.pipe(minifyCSS())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('jshint', function(){
return gulp.src('js/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'));
});
gulp.task('js',function(){
return gulp.src('js/script.js')
.pipe( include() )
.pipe(gulp.dest('assets/js'))
.pipe(uglify())
.on('error', handleError)
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('assets/js'))
.pipe(browserSync.reload({stream:true, once: true}));
});
gulp.task('images', function() {
return gulp.src('img/**/*')
.pipe(imageOptim.optimize())
.pipe(gulp.dest('assets/img'));
});
gulp.task('browser-sync', function() {
browserSync({
proxy: "promesse-damour.dev"
});
});
gulp.task('bs-reload', function () {
browserSync.reload();
});
gulp.task('default', ['css', 'admincss', 'js', 'jshint', 'browser-sync'], function () {
gulp.watch("scss/**/*.scss", ['css', 'admincss']);
gulp.watch("js/**/*.js", ['js', 'jshint']);
gulp.watch("**/*.php", ['bs-reload']);
gulp.watch("assets/img/**/*", ['bs-reload']);
});