Skip to content

Commit cb888a8

Browse files
Abstract theme configuration (#6)
* Upgrade sharp to 0.33.0 The latest version of astro has a dependency of sharp 0.33.0, so this was causing issues * Start to abstract theme configuration - Moved theme config to a preset - Moved tailwind config
1 parent 3977f7a commit cb888a8

File tree

6 files changed

+38
-365
lines changed

6 files changed

+38
-365
lines changed

astro.config.mjs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import tailwind from "@astrojs/tailwind";
21
import sitemap from "@astrojs/sitemap";
3-
import favicons from "astro-favicons";
42
import { defineConfig, envField } from "astro/config";
53
import { remarkCustomDirectives } from "./lib/remarkCustomDirectives";
6-
import { search } from "./lib/search";
4+
import { deltaTheme } from "./lib/delta-theme";
75

86
// https://astro.build/config
97
export default defineConfig({
@@ -21,21 +19,6 @@ export default defineConfig({
2119
image: {
2220
domains: [],
2321
formats: ["png", "jpg", "jpeg", "webp", "gif", "svg"],
24-
serviceEntryPoint: "@astrojs/image/sharp",
2522
},
26-
integrations: [
27-
tailwind(),
28-
search(),
29-
sitemap(),
30-
favicons({
31-
name: "Delta Lake",
32-
short_name: "Delta Lake",
33-
start_url: "/",
34-
background_color: "#042436",
35-
theme_color: "#00ADD4",
36-
icon_options: {
37-
purpose: "maskable",
38-
},
39-
}),
40-
],
23+
integrations: [sitemap(), deltaTheme({ name: "Delta Lake" })],
4124
});

lib/delta-theme/deltaTheme.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import tailwind from "@astrojs/tailwind";
2+
import favicons from "astro-favicons";
3+
import type { AstroIntegration } from "astro";
4+
import path from "path";
5+
import { search } from "../search";
6+
import { fileURLToPath } from "url";
7+
8+
interface ThemeConfig {
9+
/** site name */
10+
name: string;
11+
}
12+
13+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
14+
15+
export const deltaTheme = (config: ThemeConfig): AstroIntegration[] => {
16+
const { name } = config;
17+
18+
console.log(path.resolve(__dirname, "./tailwind.config.ts"));
19+
20+
return [
21+
tailwind({
22+
configFile: path.resolve(__dirname, "./tailwind.config.ts"),
23+
}),
24+
search(),
25+
favicons({
26+
name,
27+
short_name: name,
28+
background: "#042436",
29+
themes: ["#00ADD4"],
30+
}),
31+
];
32+
};

lib/delta-theme/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { deltaTheme } from "./deltaTheme";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"lint-staged": "^15.4.3",
5757
"prettier": "^3.5.3",
5858
"prettier-plugin-astro": "^0.14.1",
59-
"sharp": "^0.32.6",
59+
"sharp": "^0.33.0",
6060
"typescript-eslint": "^8.26.0",
6161
"vitest": "^3.0.6"
6262
}

0 commit comments

Comments
 (0)