28 lines
1.6 KiB
Markdown
28 lines
1.6 KiB
Markdown
# FastCentrik custom template compiler
|
|
|
|
This is a custom template compiler for FastCentrik. It allows you to create templates with and compile them into injectable JavaScript.
|
|
|
|
## How does it work
|
|
|
|
First in your project you have your pages, for each page you have your own set of patches.
|
|
|
|
For determining the page you can either use regex, file `route.regexpr`, simple pathname `route` file, or custom JavaScript function that has to return boolean, file `route.js`.
|
|
|
|
Each page is folder in the root of your project. Patches in pages can be stacked so multiple pages may be triggered at the same time. For example you can create page with name "global" that has this regex: `^[\s\S]*$` and patches in this page will be used throughout the whole webpage.
|
|
|
|
Each page can have multiple patches, that are in the `templates` folder in the page folder. There are 2 types of patches:
|
|
|
|
1. Custom patches
|
|
This patch can have only style.css that is not scoped and script.js. These are just normally injected into the project and can be used for minor modifications or for global styles.
|
|
2. Template patches
|
|
These patches are more complex and are expplained in [TEMPLATE_PATCHES.md](TEMPLATE_PATCHES.md)
|
|
|
|
## Known bugs
|
|
|
|
- You can't use `@keyframe` in the scoped .css file (in the templates folder). You will have to define your keyframe in your global CSS file for the specific page.
|
|
|
|
## TODO
|
|
- [ ] Add option to disable the default styles
|
|
- [ ] Hijack the loading to actually load after all the patches are applied
|
|
We can hack the current loader (the white div on the top of the webpage) to show only after all the patches are applied, so we don't have flash of the old UI.
|