Skip to content

Commit

Permalink
update:Add gulp && complie the less files
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyangguo committed Apr 17, 2018
1 parent 6dbdd4c commit 19a974a
Show file tree
Hide file tree
Showing 11 changed files with 24,542 additions and 2 deletions.
Binary file added dist/css/fonts/rsuite-icon-font.eot
Binary file not shown.
2,304 changes: 2,304 additions & 0 deletions dist/css/fonts/rsuite-icon-font.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/css/fonts/rsuite-icon-font.ttf
Binary file not shown.
Binary file added dist/css/fonts/rsuite-icon-font.woff
Binary file not shown.
22,153 changes: 22,153 additions & 0 deletions dist/css/rsuite.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/css/rsuite.css.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/css/rsuite.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/css/rsuite.min.css.map

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"build": "rm -rf lib && babel src --out-dir lib ",
"tdd": "karma start",
"lint": "eslint src *.js*",
"dist": "rm -rf dist && NODE_ENV=production webpack --mode production --progress ",
"gulp": "gulp --gulpfile scripts/gulpfile.js",
"dist": "rm -rf dist && NODE_ENV=production webpack --mode production --progress && gulp",
"test": "npm run lint && NODE_ENV=coverage karma start --single-run",
"coveralls": "cat ./coverage/lcov/lcov.info | ./node_modules/.bin/coveralls",
"flow": "flow"
Expand Down Expand Up @@ -59,6 +60,7 @@
"react-dom": "^0.14.9 || >=15.3.0"
},
"devDependencies": {
"autoprefixer": "^8.3.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^7.1.4",
Expand All @@ -76,6 +78,7 @@
"brfs": "^1.6.1",
"chai": "^4.1.0",
"coveralls": "^2.13.1",
"cssnano": "^3.10.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-babel": "^4.1.1",
Expand All @@ -86,6 +89,12 @@
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.7.0",
"flow-bin": "^0.61.0",
"gulp": "^3.9.1",
"gulp-clean": "^0.4.0",
"gulp-less": "^4.0.0",
"gulp-postcss": "^7.0.1",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^2.6.4",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
Expand All @@ -109,5 +118,10 @@
"webpack": "^4.5.0",
"webpack-cli": "^2.0.14",
"webpack-dev-server": "^2.3.0"
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"ie >= 9"
]
}
16 changes: 16 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const plugins = [
require('autoprefixer'),
require('cssnano')({
preset: [
'default', {
discardComments: {
removeAll: true
}
}
]
})
];

module.exports = {
plugins
};
49 changes: 49 additions & 0 deletions scripts/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const gulp = require('gulp');
const clean = require('gulp-clean');
const less = require('gulp-less');
const postcss = require('gulp-postcss');
const sourcemaps = require('gulp-sourcemaps');
const rename = require('gulp-rename');

const SOURCE_PATH = '../styles/less';
const DIST_PATH = '../dist/css';

gulp.task('clean', () => {
return gulp.src(DIST_PATH, { read: true })
.pipe(clean({ force: true }))
});

gulp.task('build-less', () => {
return gulp.src(`${SOURCE_PATH}/rsuite.less`)
.pipe(sourcemaps.init())
.pipe(less({ javascriptEnabled: true }))
.pipe(postcss([
require('autoprefixer')
]))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(`${DIST_PATH}`));
});

gulp.task('min-css', () => {
return gulp.src(`${DIST_PATH}/rsuite.css`)
.pipe(sourcemaps.init())
.pipe(postcss())
.pipe(rename(path => {
path.basename += '.min'
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(`${DIST_PATH}`))
});

gulp.task('postcss', ['build-less'], () => {
return gulp.start('min-css');
});

gulp.task('copy-fonts', () => {
return gulp.src(`${SOURCE_PATH}/fonts/**/*`)
.pipe(gulp.dest(`${DIST_PATH}/fonts`))
});

gulp.task('default', ['clean'], () => {
gulp.start(['postcss', 'copy-fonts']);
});

0 comments on commit 19a974a

Please sign in to comment.