我最近开始尝试使用语义 UI。我在我保存在 git repo 中的项目中使用它。
我使用所有默认设置将语义文件添加到项目根目录中的语义 文件夹。我以后可能会也可能不会更改这些设置。
我的问题是,如何正确地将文件夹添加到 git?如果可能的话,我不想添加稍后可以使用 gulp
简单地重建的文件。我应该添加哪些文件以及应该忽略哪些文件?
最佳答案
我最终部分遵循了@fstanis 在 How can I separate generated artifacts from the main build with semantic UI? 的回答, 由@poke 链接。
我保留了:
- semantic.json
- 语义/src/
- semantic/gulpfile.js(因为我没有在项目的其他地方使用
gulp
)
我忽略了:
- 语义/距离/
- semantic/tasks/,因为它与 node_modules/semantic-ui/tasks 完全相同,因此可以复制
我还如下扩充了 semantic/gulpfile.js 以检查 semantic/tasks 是否存在,如果不存在则将其复制到那里。
/* Very top of semantic/gulpfile.js */
var fs = require('fs-extra'); // Used for recursive copying
var path = require('path');
try {
var stat = fs.statSync(path.join(__dirname, './tasks'));
console.log('\'tasks\' folder already exists. Continuing.')
} catch (e) {
console.log('Copying \'tasks\' folder from \'node_modules/semantic-ui/tasks\'');
fs.copySync(path.join(__dirname, '../node_modules/semantic-ui/tasks'), path.join(__dirname, './tasks'));
console.log('Copying done! Continuing.');
}
这似乎是可构建的语义 UI 安装所需的最低要求。
关于git - .gitignore 中的语义 UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32538811/