Skip to content

Commit f1c626d

Browse files
committed
feat(app): external styles, override instead of deleting default folder
1 parent 1cbb73a commit f1c626d

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,27 @@ compodoc -p src/tsconfig.json
121121

122122
### Styling the documentation
123123
```
124-
compodoc -y your_folder/
124+
compodoc -p src/tsconfig.json -y your_theme_styles/
125125
```
126-
Inside your folder you need to provide at least a style.css file. If you need more files you can import them.
127-
@Example (style.css):
126+
127+
Inside your folder you need to provide at least a style.css file with these 5 imports as below.
128+
128129
```
129130
@import "./reset.css";
130131
@import "./bootstrap.min.css";
131132
@import "./bootstrap-card.css";
132133
@import "./font-awesome.min.css";
133-
@import "./app.css";
134+
@import "./compodoc.css";
135+
```
136+
137+
Compodoc use [bootstrap](http://getbootstrap.com/) 3.3.7. You can customize Compodoc easily.
138+
139+
[bootswatch.com](http://bootswatch.com/) can be a good starting point. If you want to override the default theme, just provide a bootstrap.min.css file, and it will override the default one.
140+
141+
```
142+
└── your_theme_styles/
143+
├── style.css // the main css file with default imports
144+
└── bootstrap.min.css // your bootstrap theme
134145
```
135146

136147
### Serve generated documentation with compodoc

src/app/application.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,12 @@ export namespace Application {
349349
}
350350
else {
351351
if (program.extTheme) {
352-
fs.emptyDir(path.resolve(process.cwd() + path.sep + defaultFolder + 'styles'), function (err) {
352+
fs.copy(path.resolve(process.cwd() + path.sep + program.extTheme), path.resolve(process.cwd() + path.sep + defaultFolder + '/styles/'), function (err) {
353353
if (err) {
354-
logger.error('Impossible to delete the documentation styles folder');
355-
}
356-
else {
357-
fs.copy(path.resolve(process.cwd() + path.sep + program.extTheme), path.resolve(process.cwd() + path.sep + defaultFolder + '/styles/'), function (err) {
358-
if (err) {
359-
logger.error('Error during external styling theme copy ', err);
360-
} else {
361-
logger.info('External styling theme copy succeeded');
362-
processGraphs();
363-
}
364-
});
354+
logger.error('Error during external styling theme copy ', err);
355+
} else {
356+
logger.info('External styling theme copy succeeded');
357+
processGraphs();
365358
}
366359
});
367360
}

0 commit comments

Comments
 (0)