-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
80 lines (72 loc) · 2.47 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
/*!
* bootstrap-card-extender v1.0.0 (http://javatmp.com)
* Extending bootstrap card by adding option buttons
* that help make Bootstrap Card more responsive and interactive
*
* Copyright 2018 JavaTMP
* Licensed under MIT (https://github.com/JavaTMP/bootstrap-card-extender/blob/master/LICENSE)
*/
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var del = require('del');
var eslint = require('gulp-eslint');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var cleanCSS = require('gulp-clean-css');
var autoprefixer = require('gulp-autoprefixer');
var header = require('gulp-header');
var pkg = require('./package.json');
var banner = ['/*!',
' * <%= pkg.name %> (http://javatmp.com)',
' * <%= pkg.description %>',
' *',
' * @version <%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @copyright 2018 JavaTMP',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
gulp.task('clean', function () {
return del(['./dist']);
});
gulp.task('sass', gulp.series("clean", function () {
return gulp.src([
'./sass/bootstrap-card-extender.scss'
])
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(cleanCSS())
.pipe(header(banner, {pkg: pkg}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/'));
}));
gulp.task('js', gulp.series("clean", function (cb) {
return gulp.src('./js/bootstrap-card-extender.js')
.pipe(eslint({
"env": {"browser": true, "node": true, "jquery": true},
"rules": {
"semi": 2,
"eqeqeq": 1,
"quotes": 0,
"no-trailing-spaces": 1,
"eol-last": 1,
"no-unused-vars": 0,
"no-underscore-dangle": 1,
"no-alert": 1,
"no-lone-blocks": 1
},
"globals": ["jQuery", "$"]
}))
.pipe(eslint.format())
.pipe(uglify({output: {comments: /^!/}}))
.pipe(header(banner, {pkg: pkg}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/'));
}));
gulp.task('default', gulp.series("sass", "js", function () {
// place code for your default task here
}));