Skip to content

Instantly share code, notes, and snippets.

@ZachSaucier
Created January 24, 2024 16:54
Show Gist options
  • Select an option

  • Save ZachSaucier/30ff2764a1b2aacfb244ccc2dc6e77d5 to your computer and use it in GitHub Desktop.

Select an option

Save ZachSaucier/30ff2764a1b2aacfb244ccc2dc6e77d5 to your computer and use it in GitHub Desktop.

Revisions

  1. ZachSaucier created this gist Jan 24, 2024.
    11 changes: 11 additions & 0 deletions svelte.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    // apps/website-1/svelte.config.js

    import { createSvelteConfig } from 'config/svelte.js'
    import adapter from '@sveltejs/adapter-cloudflare'

    export default createSvelteConfig({
    adapter: adapter(),
    alias: {
    $sections: 'src/sections',
    },
    })
    38 changes: 38 additions & 0 deletions svelte.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    // packages/config/svelte.js

    import { resolve, join } from 'path'
    import { fileURLToPath } from 'url'
    import preprocess from 'svelte-preprocess'

    const stylesPath = `${resolve(fileURLToPath(import.meta.url), '../../../packages/styles')}`
    export const scssImports = `@use "${join(stylesPath, 'imports.scss')}" as *;`

    /** @type {import('@sveltejs/kit').Config} */
    export const createSvelteConfig = ({ adapter, kit, alias, ...rest }) => {
    return {
    // Preprocessors docs: https://github.com/sveltejs/svelte-preprocess
    preprocess: preprocess({
    scss: {
    prependData: scssImports,
    }
    }),

    kit: {
    adapter,
    alias: {
    $components: 'src/components',
    $animations: 'src/animations',
    $utils: 'src/utils',
    $styles: 'src/styles',
    ...alias,
    },
    prerender: {
    handleMissingId: 'ignore',
    },
    inlineStyleThreshold: 4096,
    ...kit,
    },

    ...rest,
    }
    }