diff --git a/build/bin/gen-cssfile.js b/build/bin/gen-cssfile.js new file mode 100644 index 000000000..033260716 --- /dev/null +++ b/build/bin/gen-cssfile.js @@ -0,0 +1,27 @@ +var fs = require('fs'); +var path = require('path'); +var Components = require('../../components.json'); +var THEMES = [ + 'theme-default' +]; +var BASEPATH = path.resolve(__dirname, '../../packages/'); +Components = Object.keys(Components); + +function fileExists(filePath) { + try { + return fs.statSync(filePath).isFile(); + } catch (err) { + return false; + } +}; + +THEMES.forEach(function(theme) { + Components.forEach(function(key) { + var fileName = key + '.css'; + var filePath = path.resolve(BASEPATH, theme, 'src', fileName); + if (!fileExists(filePath)) { + fs.writeFileSync(filePath, '', 'utf8'); + console.log(theme, ' 创建遗漏的 ', fileName, ' 文件'); + } + }); +}); diff --git a/package.json b/package.json index 3c6242750..bbfc5fb69 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dev": "npm run bootstrap && npm run build:file && cooking watch -c build/cooking.demo.js -p", "dist": "npm run clean && npm run build:file && npm run lint && cooking build -c build/cooking.conf.js,build/cooking.common.js,build/cooking.component.js -p && npm run build:utils && npm run build:theme", "dist:all": "node build/bin/build-all.js && npm run build:theme", - "build:theme": "gulp build --gulpfile packages/theme-default/gulpfile.js && cp-cli packages/theme-default/lib lib/theme-default", + "build:theme": "node build/bin/gen-cssfile && gulp build --gulpfile packages/theme-default/gulpfile.js && cp-cli packages/theme-default/lib lib/theme-default", "deploy": "npm run build:file && cooking build -c build/cooking.demo.js -p && echo element.eleme.io>>examples/element-ui/CNAME && gh-pages -d examples/element-ui --remote eleme && del examples/element-ui", "bootstrap": "npm i && lerna bootstrap", "pub": "sh build/release.sh",