Skip to content

Commit 5d0b0af

Browse files
committed
build sass
1 parent 4bd7305 commit 5d0b0af

File tree

3 files changed

+233
-19
lines changed

3 files changed

+233
-19
lines changed

gulpfile.babel.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import gulp from 'gulp';
22
import babel from 'gulp-babel';
3+
import sass from 'gulp-sass';
4+
import cleanCSS from 'gulp-clean-css';
5+
import rename from 'gulp-rename';
36
import rimraf from 'rimraf';
47
import * as path from 'path';
58

6-
79
gulp.task('default', ['prod']);
810

911
gulp.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']);

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
"eslint-plugin-react": "7.2.1",
4949
"gulp": "3.9.1",
5050
"gulp-babel": "7.0.0",
51+
"gulp-clean-css": "3.9.2",
52+
"gulp-rename": "^1.2.2",
53+
"gulp-sass": "3.1.0",
5154
"html-webpack-plugin": "2.30.1",
5255
"jest": "20.0.4",
5356
"jsdom": "11.2.0",

0 commit comments

Comments
 (0)