Add support for custom CSS files #11

Merged
tslocum merged 4 commits from f/twins:custom-css into master 2021-07-10 02:37:56 +00:00
Contributor

Specify the styles config option for a host and point to a
valid CSS file to use this instead of the default one. This fixes #9.

Specify the ```styles``` config option for a host and point to a valid CSS file to use this instead of the default one. This fixes #9.
f added 1 commit 2021-06-08 20:12:24 +00:00
83453281bc Add support for custom CSS files
Specify the ```styles``` config option for a host and point to a
valid CSS file to use this instead of the default one. This fixes #9.
Author
Contributor

Any update on this?

Any update on this?
tslocum requested changes 2021-07-09 05:37:30 +00:00
tslocum left a comment
Owner

Thanks for submitting these changes.

Thanks for submitting these changes.
CONFIGURATION.md Outdated
@ -81,6 +81,11 @@ Set this option to `true` to disable this feature.
Pages are converted automatically by [gmitohtml](https://code.rocketnine.space/tslocum/gmitohtml).
## Styles
Owner

Please rename the option to StyleSheet.

Please rename the option to StyleSheet.
Author
Contributor

Renamed it to StyleSheet

Renamed it to ```StyleSheet```
f marked this conversation as resolved
serve_https.go Outdated
@ -34,0 +40,4 @@
return http.StatusNotFound, -1, ""
}
cssBytes, err = ioutil.ReadFile(styleFilepath)
Owner

Please load the custom style sheets during server initialization, so that they only need to be loaded once.

Please do not overwrite cssBytes, as it may be used by hosts which lack a custom style sheet.

Please load the custom style sheets during server initialization, so that they only need to be loaded once. Please do not overwrite cssBytes, as it may be used by hosts which lack a custom style sheet.
Author
Contributor

I've put it in the config.go, which seems the right place to do it.

I've put it in the ```config.go```, which seems the right place to do it.
f marked this conversation as resolved
f added 1 commit 2021-07-09 20:18:03 +00:00
8654f0ca1b Rename to StyleSheet and precache CSS bytes
If there is a custom CSS file specified and usable (it exists and is
readable), we precache it on server startup (for every host). This
increase the request performance and reduce IO-load slightly.
f added 1 commit 2021-07-09 20:20:14 +00:00
f added 1 commit 2021-07-09 20:21:41 +00:00
tslocum merged commit 9cd235c469 into master 2021-07-10 02:37:56 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tslocum/twins#11
No description provided.