diff --git a/site/src/lib/framework.ts b/site/src/lib/framework.ts index 69d3b9ec..12be37c3 100644 --- a/site/src/lib/framework.ts +++ b/site/src/lib/framework.ts @@ -1,3 +1,5 @@ +import { trimSlash } from './url' + export type FrameworkData = { name: string | undefined sandbox: string @@ -56,8 +58,9 @@ export const toFrameworkPath = ( // New prefix to prepend, based on new framework: const prefix = id === DEFAULT_FRAMEWORK ? '' : '/' + id - if (firstSegment && Object.keys(FRAMEWORKS).includes(firstSegment)) - return prefix + '/' + segments.join('/') + if (firstSegment && Object.keys(FRAMEWORKS).includes(firstSegment)) { + return trimSlash(prefix + '/' + segments.join('/')) + } // It was on the default framework - return prefix + path + return trimSlash(prefix + path) } diff --git a/site/src/lib/url.ts b/site/src/lib/url.ts index f71463a7..43bff98d 100644 --- a/site/src/lib/url.ts +++ b/site/src/lib/url.ts @@ -15,3 +15,5 @@ export const isActive = ( toFrameworkPath(path, DEFAULT_FRAMEWORK), toFrameworkPath(urlOrPathname, DEFAULT_FRAMEWORK) ) + +export const trimSlash = (path: string | undefined) => path?.replace(/(.)\/$/, '$1') diff --git a/site/tailwind.config.ts b/site/tailwind.config.ts index 5f5e063b..f08c21ea 100644 --- a/site/tailwind.config.ts +++ b/site/tailwind.config.ts @@ -10,10 +10,7 @@ import type { PluginUtils } from 'tailwindcss/types/config' const sans = ['Inter', '_font_fallback_732902278794', 'sans-serif'] export default { - presets: [reset], - future: { - hoverOnlyWhenSupported: true - }, + presets: [reset({ hoverOnlyWhenSupported: true })], content: { files: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], transform: {