-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
131 lines (104 loc) · 3.35 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
var gulp = require('gulp'),
gutil = require('gulp-util' ),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
cleanCSS = require('gulp-clean-css'),
rename = require('gulp-rename'),
sourcemaps = require('gulp-sourcemaps'),
del = require('del'),
imagemin = require('gulp-imagemin'),
cache = require('gulp-cache'),
autoprefixer = require('gulp-autoprefixer'),
bourbon = require('node-bourbon'),
ftp = require('vinyl-ftp'),
gulpImports = require('gulp-imports'),
combineMq = require('gulp-combine-mq'),
notify = require("gulp-notify"),
useref = require('gulp-useref'),
minifyInline = require('gulp-minify-inline'),
gulpif = require('gulp-if'),
image = require('gulp-image'),
wiredep = require('gulp-wiredep');
// // з папки bower в html
// gulp.task('bower', function () {
// gulp.src('./app/index.html')
// .pipe(wiredep({
// directory: "app/bower_components/"
// }))
// .pipe(gulp.dest('./app'))
// })
gulp.task('image', function () {
});
// delete /dist
gulp.task('removedist', function() { return del.sync('dist'); });
// чистий код в папку dist
gulp.task('build', ['removedist'], function () {
// gulp.src([
// 'app/img/**/*',
// ]).pipe(gulp.dest('dist/img'));
gulp.src([
'app/css/**/*',
]).pipe(gulp.dest('dist/css'));
gulp.src([
'app/scss/**/*',
]).pipe(gulp.dest('dist/scss'));
gulp.src([
'app/js/**/*',
]).pipe(gulp.dest('dist/js'));
gulp.src('./app/img/**/*')
.pipe(image())
.pipe(gulp.dest('./dist/img/'));
gulp.src([
'app/fonts/**/*',
]).pipe(gulp.dest('dist/fonts'));
return gulp.src('app/*.html')
.pipe(gulp.dest('dist'));
});
// Скрипты проекта
gulp.task('scripts', function() {
return gulp.src(['app/js/main.js'])
.pipe(gulpImports())
.pipe(uglify())
.pipe(rename({suffix: ".min"}))
.pipe(gulp.dest('app/js'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: './app/'
},
// proxy: 'https://dodomy.com.wm/app/',
// port: 8080,
// notify: false,
// online: true,
// tunnel: true,
// tunnel: "gootex", //Demonstration page: http://projectmane.localtunnel.me
});
});
gulp.task('sass', function() {
return gulp.src(['app/scss/style.scss', 'app/scss/style-mobile.scss', ])
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
// .pipe(combineMq({
// beautify: true
// }))
.pipe(rename({suffix: '.min'}))
// .pipe(autoprefixer(['last 5 versions']))
// .pipe(cleanCSS({
// keepSpecialComments : 0,
// }))
.pipe(minifyInline())
.pipe(sourcemaps.write())
.pipe(gulp.dest('app/css'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('watch', function() {
// gulp.watch('bower.json', ['bower']);
gulp.watch('app/scss/**/*.scss', ['sass']);
gulp.watch('app/js/main.js', ['scripts']);
gulp.watch('app/*.html').on("change", browserSync.reload);
});
gulp.task('default', ['browser-sync', 'sass', 'scripts', 'watch']);