-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
51 lines (46 loc) · 1.32 KB
/
gulpfile.js
File metadata and controls
51 lines (46 loc) · 1.32 KB
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
'use strict';
const path = require('path');
const gulp = require('gulp');
const gutil = require('gulp-util');
const rename = require("gulp-rename");
const uglify = require('gulp-uglify');
const rimraf = require('gulp-rimraf');
const header = require('gulp-header');
const less = require('gulp-less');
const cleanCSS = require('gulp-clean-css');
const sourcemaps = require('gulp-sourcemaps');
const pkg = require('./package.json');
const basename = 'bootstrap-theme-attrs';
gulp.task('build.clean', () => {
return gulp.src('dist', { read: false })
.pipe(rimraf());
});
gulp.task('build', ['build.clean'], () => {
return gulp.src('less/index.less')
.pipe(sourcemaps.init({largeFile: true}))
.pipe(less())
.pipe(header([
'/*!',
'* <%= pkg.name %>',
'* <%= pkg.homepage %>',
'*',
'* Copyright attrs and others',
'* Released under the MIT license',
'* https://github.com/<%=pkg.repository%>/blob/master/LICENSE',
'*/',
''
].join('\n'), { pkg: pkg }))
.pipe(rename({
basename: basename
}))
.pipe(gulp.dest('dist'))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(rename({
suffix: '.min'
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});
// conclusion
gulp.task('watch', ['build.watch']);
gulp.task('default', ['build']);