Skip to content

MDsveX + SvelteKit #217

Answered by rmunn
janosh asked this question in Q&A
Oct 24, 2020 · 19 comments · 6 replies
Discussion options

You must be logged in to vote

I just tried it today, and it Just Works™:

// svelte.config.cjs
const { mdsvex } = require(`mdsvex`)

module.exports = {
    extensions: ['.svelte', '.svx'],
    preprocess: [ mdsvex() ],
    // kit: { ... } omitted for brevity (unchanged from default)
};

With that svelte.config.cjs file, I can create src/routes/blogpost.svx and it Just Works. I was also able to create src/routes/[slug].svx and it was handled correctly too:

<script context="module">
    export function load({ page }) {
        const { slug } = page.params;
        if (slug) {
            return { props: { title: slug }};
        }
    }
</script>

<script>
    import Counter from '$lib/Counter.svelte';
    export let title;

Replies: 19 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@jamesb93
Comment options

@mcmxcdev
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@DrMagPie
Comment options

@janosh
Comment options

Answer selected by pngwn
Comment options

You must be logged in to vote
2 replies
@jamesb93
Comment options

@janosh
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants
Converted from issue

This discussion was converted from issue #159 on March 27, 2021 22:19.