Skip to content

Commit

Permalink
✨ Support for custom colors
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 18, 2019
1 parent d8b604e commit 77da1e1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ You can create a `.staartrc` file or another [Cosmiconfig](https://github.com/da
| `stylePath` | Scss stylesheet path | `style.scss` |
| `homePath` | Markdown file path for homepage | `README.md` |
| `hostname` | Base URL for sitemap | `http://localhost:8080` |
| `themeColor` | Main theme color | `#0e632c` |
| `textColor` | Dark text color | `#001b01` |
| `linkColor` | Hyperlink color | `#0e632c` |
| `lightColor` | Light text color | `#ffffff` |
| `navbar` | Array of filenames for navbar | Root files/folders in `contentDir` |
| `contentFileExt` | File extension for content files | `md` |
| `keepHomeHeading` | Show `h1` heading on homepage | `false` |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@staart/site",
"version": "0.9.57",
"version": "0.9.58",
"module": "dist/module.js",
"main": "dist/index.js",
"bin": "./dist/index.js",
Expand Down
18 changes: 16 additions & 2 deletions src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const renderScss = (styles: string) =>
});
});
export const getCss = async () => {
return await cached<string>("css", async () => {
const config = await getConfig();
return (await cached<string>("css", async () => {
try {
return await renderScss(
(await readFile(await getStylePath())).toString()
Expand All @@ -76,7 +77,20 @@ export const getCss = async () => {
(await readFile(join(__dirname, "..", "src", "style.scss"))).toString()
);
}
});
}))
.replace("$theme: #0e632c", `$theme: ${config.themeColor || "#0e632c"};`)
.replace(
"$text-color: #001b01",
`$text-color: ${config.textColor || "#001b01"};`
)
.replace(
"$link-color: #0e632c",
`$link-color: ${config.linkColor || "#0e632c"};`
)
.replace(
"$light-color: #fff",
`$light-color: ${config.lightColor || "#fff"};`
);
};

export const generate = async () => {
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export interface StaartSiteConfig {
noHome?: boolean;
noSitemap?: boolean;
noContentList?: boolean;
themeColor?: string;
textColor?: string;
linkColor?: string;
lightColor?: string;
[index: string]: any;
}

Expand Down

1 comment on commit 77da1e1

@vercel
Copy link

@vercel vercel bot commented on 77da1e1 Oct 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.