-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
55 lines (49 loc) · 1.1 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
/**
* 引入 gulp
*/
const gulp = require('gulp') // 基础库
/**
* 版本信息
*/
const pkg = require('./package.json')
const gulpSequence = require('gulp-sequence')
/**
* gulp 模块化管理工具
*/
const gulpLoadPlugins = require('gulp-load-plugins') // 模块化管理
const $ = gulpLoadPlugins() // 定义变量
const scssSrc = './src/*.scss'
const banner = ['/*!',
' * <%= pkg.name %> - <%= pkg.description %>',
' * ',
' * @version v<%= pkg.version %>',
' * ',
' * @author <%= pkg.author %>',
' * ',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n')
gulp.task('build', function () {
return gulp.src(scssSrc)
.pipe($.sass.sync()
.on('error', $.sass.logError))
.pipe($.autoprefixer({
cascade: false
}))
.pipe($.csscomb())
.pipe($.cssbeautify({
indent: ' ',
openbrace: 'end-of-line',
autosemicolon: true
}))
.pipe($.header(
banner, {
pkg: pkg
}
))
.pipe(gulp.dest('./dist'))
.pipe($.sourcemaps.init())
.pipe($.sourcemaps.write('./'))
.pipe(gulp.dest('./dist'))
})