diff --git a/build/bin/build-style-entry.js b/build/bin/build-style-entry.js index a760de350..4f062cc87 100644 --- a/build/bin/build-style-entry.js +++ b/build/bin/build-style-entry.js @@ -7,6 +7,8 @@ const path = require('path'); const components = require('./get-components')(); const dependencyTree = require('dependency-tree'); +const SEP = path.sep; + components.forEach(componentName => { const libDir = path.resolve(__dirname, '../../lib'); const content = analyzeDependencies(componentName, libDir).map(component => `require('../../vant-css/${component}.css');`); @@ -19,7 +21,7 @@ function analyzeDependencies(componentName, libDir) { search(dependencyTree({ directory: libDir, filename: path.resolve(libDir, componentName, 'index.js'), - filter: path => path.indexOf('vant/lib/') !== -1 + filter: path => path.indexOf(`vant${SEP}lib${SEP}`) !== -1 }), checkList); return checkList.filter(component => checkComponentHasStyle(component)); } @@ -27,7 +29,7 @@ function analyzeDependencies(componentName, libDir) { function search(tree, checkList) { tree && Object.keys(tree).forEach(key => { search(tree[key], checkList); - const component = key.split('/vant/lib/')[1].replace('/index.js', '').replace('mixins/', ''); + const component = key.split(`${SEP}vant${SEP}lib${SEP}`)[1].replace(`${SEP}index.js`, '').replace(`mixins${SEP}`, ''); if (checkList.indexOf(component) === -1) { checkList.push(component); } diff --git a/package.json b/package.json index bc1d83724..a7796bb41 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,9 @@ "dev": "npm run build:file && webpack-dev-server --inline --config build/webpack.config.dev.js --content-base ./", "build:file": "node build/bin/build-entry.js", "build:components": "node build/bin/build-components.js --color", - "build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js --color && mkdir lib/vant-css && cp -R packages/vant-css/lib/ lib/vant-css", + "build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js --color", "build:vant": "cross-env NODE_ENV=production webpack --progress --hide-modules --color --config build/webpack.build.js && cross-env NODE_ENV=production webpack -p --progress --hide-modules --color --config build/webpack.build.js", - "build:style-entry": "VUE_ENV=server node build/bin/build-style-entry.js", + "build:style-entry": "cross-env VUE_ENV=server node build/bin/build-style-entry.js", "build:changelog": "sh build/bin/build-changelog.sh", "deploy": "npm run deploy:docs && npm run deploy:cdn && gh-pages -d docs/dist --remote youzan && rimraf docs/dist", "deploy:cdn": "superman cdn /zanui/vant docs/dist/*.js docs/dist/*.css && superman cdn /zanui/vant/async_en-US docs/dist/async_en-US/*.js && superman cdn /zanui/vant/async_zh-CN docs/dist/async_zh-CN/*.js", @@ -75,7 +75,10 @@ "friendly-errors-webpack-plugin": "^1.6.1", "gh-pages": "^1.0.0", "gulp": "^3.9.1", + "gulp-clean-css": "^3.9.0", "gulp-cssmin": "^0.2.0", + "gulp-iconfont": "^9.0.2", + "gulp-iconfont-css": "^2.1.0", "gulp-postcss": "^7.0.0", "gulp-util": "^3.0.8", "highlight.js": "^9.12.0", @@ -93,6 +96,7 @@ "karma-webpack": "^2.0.4", "markdown-it": "^8.4.0", "markdown-it-container": "^2.0.0", + "md5-file": "^3.2.3", "mocha": "^3.4.2", "postcss": "^6.0.14", "postcss-calc": "^6.0.0", diff --git a/packages/vant-css/gulpfile.js b/packages/vant-css/gulpfile.js index 7b6910416..8b5e814e0 100644 --- a/packages/vant-css/gulpfile.js +++ b/packages/vant-css/gulpfile.js @@ -35,7 +35,8 @@ gulp.task('compile', () => { .src('./src/*.css') .pipe(postcss()) .pipe(cssmin()) - .pipe(gulp.dest('./lib')); + .pipe(gulp.dest('./lib')) + .pipe(gulp.dest('../../lib/vant-css/')); }); gulp.task('icon-font-ttf', () => {