11import gulp from 'gulp' ;
22import babel from 'gulp-babel' ;
3+ import sass from 'gulp-sass' ;
4+ import cleanCSS from 'gulp-clean-css' ;
5+ import rename from 'gulp-rename' ;
36import rimraf from 'rimraf' ;
47import * as path from 'path' ;
58
6-
79gulp . task ( 'default' , [ 'prod' ] ) ;
810
911gulp . task ( 'clean' , ( ) => {
@@ -18,7 +20,7 @@ gulp.task('clean', () => {
1820 } ) ;
1921} ) ;
2022
21- gulp . task ( 'prod' , [ 'clean' ] , ( ) => {
23+ gulp . task ( 'build-js' , ( ) => {
2224 [
2325 'react-bootstrap-table2' ,
2426 'react-bootstrap-table2-editor' ,
@@ -34,3 +36,25 @@ gulp.task('prod', ['clean'], () => {
3436 . pipe ( gulp . dest ( `./packages/${ pkg } /lib` ) ) ;
3537 } ) ;
3638} ) ;
39+
40+ gulp . task ( 'build-sass' , ( ) => {
41+ [
42+ 'react-bootstrap-table2' ,
43+ 'react-bootstrap-table2-paginator'
44+ ] . forEach ( ( pkg ) => {
45+ gulp
46+ . src ( [
47+ `./packages/${ pkg } /style/**/*.scss` ,
48+ `!packages/${ pkg } /+(dist|node_modules)/**/*.scss`
49+ ] )
50+ . pipe ( sass ( ) . on ( 'error' , sass . logError ) )
51+ . pipe ( gulp . dest ( `./packages/${ pkg } /dist` ) )
52+ . pipe ( cleanCSS ( { compatibility : 'ie8' } ) )
53+ . pipe ( rename ( ( path ) => {
54+ path . extname = '.min.css' ;
55+ } ) )
56+ . pipe ( gulp . dest ( `./packages/${ pkg } /dist` ) ) ;
57+ } ) ;
58+ } ) ;
59+
60+ gulp . task ( 'prod' , [ 'clean' , 'build-js' , 'build-sass' ] ) ;
0 commit comments