Skip to content

Commit

Permalink
Update build steps
Browse files Browse the repository at this point in the history
- Remove old bash build script
- Update README for new build steps
- Backup and restore `node_modules/semantic-ui` before and after build
  • Loading branch information
xiaohanyu committed Mar 9, 2018
1 parent 34aabc1 commit 8eb920b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 57 deletions.
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,17 @@ You can check the official
[documentation](http://learnsemantic.com/guide/expert.html#manual-install)
for a detailed guide about how to customize Semantic-UI.

Here, we write a shell script to build multiple themes in one pass. You
need a vanilla Semantic-UI
[code](https://github.com/Semantic-Org/Semantic-UI) to work with us.
We have write a build script and wrap it with npm, so you can build tens of
themes in one shot. The basic workflow:

So basic workflow:

``` {.bash}
```{.bash}
git clone https://github.com/semantic-ui-forest/forest-themes.git
git clone https://github.com/Semantic-Org/Semantic-UI.git
# run a `npm install` and select "skip install" option.
cd Semantic-UI
npm install
# now go back to forest-themes repo.
cd ../forest-themes
# we prefer yarn, however, npm is also OK
yarn install
# it takes about 7 minutes to build about 20 themes.
bash -x build-all-themes.sh ../Semantic-UI
yarn run build
# all generated theme files are put into `dist` directory in forest-themes repo.
# ls -lR dist
Expand Down
42 changes: 0 additions & 42 deletions build-all-themes.sh

This file was deleted.

14 changes: 13 additions & 1 deletion build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ fse.ensureDirSync("dist/bootswatch");

const cwd = process.cwd();
const semantic_ui_dir = path.join(cwd, "node_modules/semantic-ui");
const semantic_ui_backup_dir = path.join(
cwd,
"node_modules/semantic-ui-backup"
);

const semantic_ui_themes = [
"amazon",
Expand Down Expand Up @@ -43,6 +47,9 @@ themes = {
"semantic-ui": semantic_ui_themes
};

// backup `node_modules/semantic-ui`
fse.removeSync(semantic_ui_backup_dir);
fse.copySync(semantic_ui_dir, semantic_ui_backup_dir);
fse.copySync("semantic.json", path.join(semantic_ui_dir, "semantic.json"));

for (let theme of bootswatch_themes) {
Expand All @@ -61,7 +68,7 @@ for (let category of ["bootswatch", "semantic-ui"]) {

process.chdir(semantic_ui_dir);

process.stdout.write(`building ${category}/${theme} theme ...`);
process.stdout.write(`building ${category}/${theme} theme...`);
execSync("gulp build-css");
process.stdout.write(`done.\n`);

Expand All @@ -78,4 +85,9 @@ for (let category of ["bootswatch", "semantic-ui"]) {
}
}

// restore `node_modules/semantic-ui`
fse.removeSync(semantic_ui_dir);
fse.copySync(semantic_ui_backup_dir, semantic_ui_dir);
fse.removeSync(semantic_ui_backup_dir);

process.chdir(cwd);

0 comments on commit 8eb920b

Please sign in to comment.