Created
February 20, 2024 15:26
-
-
Save pthurmond-vmlyr/bdbeebefbdebdabaae85a079f310031a to your computer and use it in GitHub Desktop.
Functional astro v4 config working with Cloudflare.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
import { fileURLToPath } from 'url'; | |
import { defineConfig } from 'astro/config'; | |
import sitemap from '@astrojs/sitemap'; | |
import tailwind from '@astrojs/tailwind'; | |
import mdx from '@astrojs/mdx'; | |
import partytown from '@astrojs/partytown'; | |
import compress from 'astro-compress'; | |
import icon from 'astro-icon'; | |
import tasks from './src/utils/tasks'; | |
import { readingTimeRemarkPlugin } from './src/utils/frontmatter.mjs'; | |
import { ANALYTICS, SITE } from './src/utils/config.ts'; | |
import cloudflare from "@astrojs/cloudflare"; | |
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | |
const whenExternalScripts = (items = []) => | |
ANALYTICS.vendors.googleAnalytics.id && ANALYTICS.vendors.googleAnalytics.partytown | |
? Array.isArray(items) | |
? items.map((item) => item()) | |
: [items()] | |
: []; | |
// https://astro.build/config | |
export default defineConfig({ | |
site: SITE.site, | |
base: SITE.base, | |
trailingSlash: SITE.trailingSlash ? 'always' : 'never', | |
output: 'hybrid', | |
integrations: [ | |
tailwind({ | |
applyBaseStyles: false | |
}), | |
sitemap(), | |
mdx(), | |
icon({ | |
include: { | |
tabler: ['*'], | |
'flat-color-icons': ['template', 'gallery', 'approval', 'document', 'advertising', 'currency-exchange', 'voice-presentation', 'business-contact', 'database'], | |
'noto-v1': ['*'] | |
} | |
}), | |
...whenExternalScripts(() => partytown({ | |
config: { | |
forward: ['dataLayer.push'] | |
} | |
})), | |
tasks(), | |
compress({ | |
CSS: true, | |
HTML: { | |
removeAttributeQuotes: false | |
}, | |
Image: false, | |
JavaScript: true, | |
SVG: true, | |
Logger: 1 | |
}) | |
], | |
markdown: { | |
remarkPlugins: [readingTimeRemarkPlugin], | |
shikiConfig: { | |
langs: ['js', 'html', 'css', 'astro', 'java', 'php', 'less', 'scss'], | |
wrap: true | |
} | |
}, | |
vite: { | |
resolve: { | |
alias: { | |
'~': path.resolve(__dirname, './src') | |
} | |
} | |
}, | |
redirects: { | |
'/all-posts': { | |
status: 301, | |
destination: '/blog' | |
} | |
}, | |
adapter: cloudflare() | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "@onwidget/astrowind", | |
"description": "AstroWind: A free template using Astro 3.0 and Tailwind CSS. Astro starter theme.", | |
"version": "1.0.0-beta.17", | |
"private": true, | |
"scripts": { | |
"dev": "astro dev", | |
"start": "astro dev", | |
"build": "astro build", | |
"preview": "astro preview", | |
"astro": "astro", | |
"format": "prettier -w .", | |
"lint:eslint": "eslint . --ext .js,.ts,.astro" | |
}, | |
"dependencies": { | |
"@astrojs/cloudflare": "^9.0.0", | |
"@astrojs/rss": "^4.0.4", | |
"@astrojs/sitemap": "^3.0.5", | |
"@astrolib/analytics": "^0.5.0", | |
"@astrolib/seo": "^1.0.0-beta.5", | |
"@fontsource-variable/inter": "^5.0.16", | |
"@iconify-json/noto-v1": "^1.1.8", | |
"astro": "^4.3.2", | |
"astro-icon": "^1.0.3", | |
"limax": "4.1.0", | |
"lodash.merge": "^4.6.2", | |
"typescript-esbuild": "^0.3.6", | |
"unpic": "^3.16.0", | |
"wrangler": "^3.16.0" | |
}, | |
"devDependencies": { | |
"@astrojs/mdx": "^2.1.1", | |
"@astrojs/partytown": "^2.0.4", | |
"@astrojs/tailwind": "5.1.0", | |
"@iconify-json/flat-color-icons": "^1.1.10", | |
"@iconify-json/tabler": "^1.1.104", | |
"@igor.dvlpr/astro-post-excerpt": "^2.1.0", | |
"@tailwindcss/typography": "^0.5.10", | |
"@types/lodash.merge": "^4.6.9", | |
"@typescript-eslint/eslint-plugin": "^6.19.1", | |
"@typescript-eslint/parser": "^6.19.1", | |
"astro-compress": "^2.2.8", | |
"eslint": "^8.56.0", | |
"eslint-plugin-astro": "^0.31.3", | |
"eslint-plugin-jsx-a11y": "^6.8.0", | |
"js-yaml": "^4.1.0", | |
"mdast-util-to-string": "^4.0.0", | |
"miniflare": "^3.20231030.0", | |
"prettier": "^3.2.4", | |
"prettier-plugin-astro": "^0.13.0", | |
"reading-time": "^1.5.0", | |
"sharp": "0.33.2", | |
"tailwind-merge": "^2.2.1", | |
"tailwindcss": "^3.4.1", | |
"typescript": "^5.3.3" | |
}, | |
"engines": { | |
"node": ">=18.14.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment