Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation documentation for SvelteKit is outdated #31

Closed
zambal opened this issue Mar 26, 2021 · 2 comments
Closed

Installation documentation for SvelteKit is outdated #31

zambal opened this issue Mar 26, 2021 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@zambal
Copy link

zambal commented Mar 26, 2021

The current documentation for using windicss with SvelteKit at https://windicss.org/guide/svelte.html#sveltekit is outdated, since it doesn't take SvelteKit's recent switch to vite into account. Although it's currently still in open beta and therefore likely a moving target, I think it would be nice to update the docs at least to the current situation.

After some fiddling, I found this to be a working solution for the latest SvelteKit/svelte@next:

// svelte.config.cjs
const node = require('@sveltejs/adapter-node');
const pkg = require('./package.json');

/** @type {import('@sveltejs/kit').Config} */
module.exports = {
  kit: {
    adapter: node(),

    target: '#svelte',

    vite: {
      ssr: {
        noExternal: Object.keys(pkg.dependencies || {})
      },
      plugins: [
        require('vite-plugin-windicss').default()
      ]
    }
  }
};

// src/routes/$layout.svelte
<script>
  import 'virtual:windi.css'
</script>

<slot></slot>
@alexanderniebuhr alexanderniebuhr self-assigned this Mar 26, 2021
@alexanderniebuhr
Copy link
Member

you are right! had no time to check on it. Please make a PR, i will approve it!

@alexanderniebuhr alexanderniebuhr added the documentation Improvements or additions to documentation label Mar 26, 2021
@zambal
Copy link
Author

zambal commented Mar 26, 2021

Sure, I just made a pull request!

@antfu antfu closed this as completed Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants