forked from dachcom-digital/jquery-doubletaptogo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
67 lines (58 loc) · 1.6 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
/*eslint-env node*/
'use strict';
var gulp = require('gulp'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
prefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
browserSync = require('browser-sync').create(),
input = {
sass: [
'src/**/*.scss'
]
};
gulp.task('default', ['watch']);
gulp.task('build', function () {
gulp.src('src/js/jquery.dcd.doubletaptogo.js')
.pipe(uglify({
preserveComments: 'license'
}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist'));
gulp.src('src/js/jquery.dcd.doubletaptogo.js').pipe(gulp.dest('dist'));
});
gulp.task('css', function () {
gulp.src(input.sass)
.pipe(sass({outputStyle: 'compressed'}))
.pipe(prefixer('last 2 version'))
.pipe(gulp.dest(function (file) {
return file.base;
}));
});
gulp.task('watch', ['prepare', 'serve'], function () {
gulp.watch(input.sass, ['css']);
});
gulp.task('serve', function () {
browserSync.init(
{
notify: false,
logLevel: 'info',
logConnections: false,
logFileChanges: false,
injectChanges: true,
files: ['./**/*.{html,htm,css,js}'],
watchOptions: {
ignored: 'node_modules'
},
server: {
baseDir: './src/'
}
}
);
});
gulp.task('prepare', ['css'], function () {
gulp.src('node_modules/jquery/dist/jquery.min.js')
.pipe(gulp.dest('src/lib/'));
});