Blame view

build/build-style.js 1.9 KB
7fa943eb   梁灏   init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  /**
   * 编译样式文件
   * iview.css 是基础组件css
   * iview.pack.css 是套装的全部css
   * iview.all.css 是基础组件加套装的全部css
   * packages/*.css 是某个套装的css
   * article.css 是文章排版的css
   * */
  var gulp = require('gulp');
  var minifyCSS = require('gulp-minify-css');
  var less = require('gulp-less');
  var rename = require('gulp-rename');
  var concat = require('gulp-concat');
  
  // 组件的基础css
  gulp.task('base', function () {
4b05d84e   梁灏   Modify the direct...
17
       gulp.src('../src/styles/index.less')
7fa943eb   梁灏   init
18
19
20
21
22
23
24
25
           .pipe(less())
           .pipe(minifyCSS())
           .pipe(rename('iview.css'))
           .pipe(gulp.dest('../dist/styles'))
  });
  
  // 字体
  gulp.task('fonts', function () {
4b05d84e   梁灏   Modify the direct...
26
      gulp.src('../src/styles/common/iconfont/fonts/*.*')
7fa943eb   梁灏   init
27
28
29
30
31
          .pipe(gulp.dest('../dist/styles/fonts'))
  });
  
  // 文章排版
  gulp.task('article', function () {
4b05d84e   梁灏   Modify the direct...
32
      gulp.src('../src/styles/article/index.less')
7fa943eb   梁灏   init
33
34
35
36
37
38
39
40
          .pipe(less())
          .pipe(minifyCSS())
          .pipe(rename('article.css'))
          .pipe(gulp.dest('../dist/styles'))
  });
  
  // 套装的全部css
  gulp.task('pack-all', function () {
4b05d84e   梁灏   Modify the direct...
41
      gulp.src('../src/styles/package.less')
7fa943eb   梁灏   init
42
43
44
45
46
47
48
49
          .pipe(less())
          .pipe(minifyCSS())
          .pipe(rename('iview.pack.css'))
          .pipe(gulp.dest('../dist/styles'))
  });
  
  // 每个套装的css
  gulp.task('pack', function () {
4b05d84e   梁灏   Modify the direct...
50
      gulp.src(['../src/styles/packages/*.less', '!../src/styles/packages/index.less'])
7fa943eb   梁灏   init
51
52
53
54
55
56
57
58
59
60
          .pipe(less())
          .pipe(minifyCSS())
          .pipe(rename({
              prefix: 'iview.pack.'
          }))
          .pipe(gulp.dest('../dist/styles/packages'))
  });
  
  // 全部css(包含组件和套装)
  gulp.task('all', function () {
4b05d84e   梁灏   Modify the direct...
61
      gulp.src(['../src/styles/index.less', '../src/styles/package.less'])
7fa943eb   梁灏   init
62
63
64
65
66
67
68
          .pipe(less())
          .pipe(concat('iview.all.css'))
          .pipe(minifyCSS())
          .pipe(gulp.dest('../dist/styles'))
  });
  
  gulp.task('default', ['base', 'fonts', 'article', 'pack-all', 'pack', 'all']);