mirror of https://github.com/ElemeFE/element
feat: auto generator cssfile (#368)
parent
2bbd8d08a1
commit
8fda06a54c
|
@ -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, ' 文件');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -13,7 +13,7 @@
|
||||||
"dev": "npm run bootstrap && npm run build:file && cooking watch -c build/cooking.demo.js -p",
|
"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": "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",
|
"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",
|
"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",
|
"bootstrap": "npm i && lerna bootstrap",
|
||||||
"pub": "sh build/release.sh",
|
"pub": "sh build/release.sh",
|
||||||
|
|
Loading…
Reference in New Issue