Skip to content

Commit

Permalink
Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
deeprobin committed Sep 1, 2023
1 parent 0779e70 commit 811a241
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 43 deletions.
14 changes: 7 additions & 7 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import solidJs from "@astrojs/solid-js";
import solid from "@astrojs/solid-js";
import prefetch from "@astrojs/prefetch";
import sitemap from "@astrojs/sitemap";
import compressor from "astro-compressor";
Expand All @@ -10,7 +10,6 @@ import rome from "astro-rome";

//import deno from '@astrojs/deno';
import nodejs from '@astrojs/node';

import partytown from "@astrojs/partytown";

// https://astro.build/config
Expand All @@ -19,7 +18,7 @@ export default defineConfig({
adapter: nodejs({
mode: 'standalone'
}),
integrations: [solidJs(), prefetch(), sitemap({
integrations: [solid(), prefetch(), sitemap({
i18n: {
defaultLocale: "en",
locales: {
Expand All @@ -35,7 +34,11 @@ export default defineConfig({
config: {
forward: ["dataLayer.push"]
}
}), compressor(), compress()],
}), compress(), compressor({
brotli: true,
gzip: true,
fileExtensions: [".html", ".xml", ".css", ".js", ".json", ".png", ".jpg", ".jpeg", ".webp", ".avif", ".ico", ".svg", ".jxl", ".xsl", ".woff2", ".woff", ".ttf", ".eot", ".otf", ".txt", ".md", ".webmanifest", ".mp4", ".webm", ".ogg", ".mp3", ".wav", ".flac", ".aac", ".m4a", ".oga", ".opus", ".svgz", ".zip", ".gz", ".tgz", ".tar", ".rar", ".7z", ".bz2", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".ods", ".odp", ".csv", ".rtf", ".epub", ".mobi", ".apk", ".exe", ".swf", ".jar", ".gif", ".bmp", ".ico", ".tif", ".tiff", ".psd", ".ai", ".indd", ".webp", ".avif", ".svg", ".mpg", ".mp2", ".mpeg", ".mpe", ".mpv", ".ogg", ".m4p", ".m4v", ".avi", ".wmv", ".mov", ".qt", ".flv", ".swf", ".avchd", ".mkv", ".webm", ".mng", ".asf", ".wmv", ".avi", ".mp4", ".m4v", ".mpg", ".mpeg", ".mov", ".webm", ".flv", ".mng", ".asx", ".asf", ".wmv", ".avi", ".mp4", ".m4v", ".mpg", ".mpeg", ".mov", ".webm", ".flv", ".mng", ".asx", ".asf", ".wmv", ".avi", ".mp4", ".m4v", ".mpg", ".mpeg", ".mov", ".webm", ".flv", ".mng", ".asx", ".asf", ".wmv", ".avi", ".mp4", ".m4v", ".mpg", ".mpeg", ".mov", ".webm", ".flv", ".mng", ".asx", ".asf", ".wmv", ".svg", ".svgz", ".webp", ".avif", ".png", ".jpg", ".jpeg", ".gif", ".webp", ".avif", ".ico", ".tif", ".tiff", ".psd", ".raw", ".bmp"]
})],
experimental: {
//assets: true,
//viewTransitions: true
Expand All @@ -46,9 +49,6 @@ export default defineConfig({
output: "hybrid",
site: "https://lindnerit.io/",
compressHTML: true,
build: {
split: true
},
vite: {
build: {
modulePreload: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@astrojs/prefetch": "^0.2.3",
"@astrojs/rss": "^2.4.4",
"@astrojs/sitemap": "^1.4.0",
"@astrojs/solid-js": "^2.2.1",
"@astrojs/solid-js": "^3.0.0",
"@contentful/rich-text-html-renderer": "^16.1.1",
"@contentful/rich-text-plain-text-renderer": "^16.0.6",
"@contentful/rich-text-types": "^16.2.1",
Expand Down
104 changes: 93 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/components/BlogSection.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import { BlogPost, BlogPostSkeleton, contentfulClient } from "../contentful";
import type { BlogPost, BlogPostSkeleton } from "../contentful";
import { contentfulClient } from "../contentful";
import BlogCard from "./BlogCard.astro";
import { useTranslations } from "../i18n";
const { language } = Astro.params;
Expand Down
1 change: 1 addition & 0 deletions src/components/CookieBanner/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
left: 0;
right: 0;
background-color: white;
color: black;
padding: 2rem;
gap: 2rem;
box-shadow: 0px 4px 9px #171a1f, 0px 0px 2px #171a1f;
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ if(Astro.site) {
<link rel="dns-prefetch preconnect" href="https://www.googletagmanager.com/" />
<link rel="dns-prefetch preconnect" href="https://m.clarity.ms/collect" crossorigin />

<meta name="msapplication-TileImage" content="./favicon-152.png" />
<meta name="msapplication-TileImage" content="/favicon-152.png" />
<meta name="msapplication-TileColor" content="#0093e7" />
<meta name="theme-color" content="#0093e7" />

Expand Down
7 changes: 2 additions & 5 deletions src/pages/[language]/blog/[category]/[slug].astro
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
---
export const prerender = false;
import {
contentfulClient,
BlogPostSkeleton,
BlogPost,
} from "../../../../contentful";
import { contentfulClient } from "../../../../contentful";
import type { BlogPostSkeleton, BlogPost } from "../../../../contentful";
import { documentToHtmlString } from "@contentful/rich-text-html-renderer";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
import Heading from "../../../../components/Heading.astro";
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[language]/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import BaseLayout from "../../../layouts/BaseLayout.astro";
import HookSection from "../../../components/HookSection.astro";
import { useTranslations } from "../../../i18n";
import { MetaBuilder } from "../../../meta";
import {
import type {
BlogCategory,
BlogCategorySkeleton,
BlogPost,
BlogPostSkeleton,
contentfulClient,
BlogPostSkeleton
} from "../../../contentful";
import { contentfulClient } from "../../../contentful";
import BlogCard from "../../../components/BlogCard.astro";
const { language } = Astro.params;
Expand Down
6 changes: 4 additions & 2 deletions src/pages/[language]/blog/rss.xml.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { getStaticPaths } from "../../../paramHelper";
export { getStaticPaths };

import { BlogPost, BlogPostSkeleton, contentfulClient } from '../../../contentful';
import type { BlogPost, BlogPostSkeleton } from '../../../contentful';
import { contentfulClient } from '../../../contentful';
import type { APIRoute } from 'astro';
import rss, { RSSFeedItem } from '@astrojs/rss';
import rss from '@astrojs/rss';
import type { RSSFeedItem } from '@astrojs/rss';
import { documentToPlainTextString } from "@contentful/rich-text-plain-text-renderer";

export const get: APIRoute = async ({ params }) => {
Expand Down
7 changes: 2 additions & 5 deletions src/pages/[language]/privacy-policy.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
//export { getStaticPaths };
export const prerender = false;
import {
ContentPageSkeleton,
ContentPage,
contentfulClient,
} from "../../contentful";
import type { ContentPageSkeleton, ContentPage } from "../../contentful";
import { contentfulClient } from "../../contentful";
import { documentToHtmlString } from "@contentful/rich-text-html-renderer";
import BaseLayout from "../../layouts/BaseLayout.astro";
import Heading from "../../components/Heading.astro";
Expand Down
7 changes: 2 additions & 5 deletions src/pages/[language]/terms-of-service.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
//export { getStaticPaths };
export const prerender = false;
import {
ContentPageSkeleton,
ContentPage,
contentfulClient,
} from "../../contentful";
import type { ContentPageSkeleton, ContentPage } from "../../contentful";
import { contentfulClient } from "../../contentful";
import { documentToHtmlString } from "@contentful/rich-text-html-renderer";
import BaseLayout from "../../layouts/BaseLayout.astro";
import Heading from "../../components/Heading.astro";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[language]/web-design/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const meta = metaBuilder.create();
<a
href="https://www.designrush.com/agency/profile/lindner-it"
target="_blank"
rel="sponsored nofollow">{t("webDesign.designrush") as string}</a
rel="sponsored">{t("webDesign.designrush") as string}</a
>
</div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
"extends": "astro/tsconfigs/strictest",
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "solid-js"
"jsxImportSource": "solid-js",
"paths": {
"@components/*": [
"src/components/*"
],
"@layouts/*": [
"src/layouts/*"
],
}
}
}

0 comments on commit 811a241

Please sign in to comment.