DEV Community

Discussion on: Sveltekit Vite with Tailwind 2

Collapse
 
dansvel profile image
dan • Edited

@avorona , I think I've found the problem, I think it's because svelte compiles all files into .js ,, soglobal.pcss becomes global.js ,, or index.pcss or other name

what we can do to run the run build without problems,

  • rename the file global.pcss toGlobalStyle.svelte
  • edit the contents of GlobalStyle.svelte to be something like this
<style global>
/* preprocessing css goes here */
</style>
Enter fullscreen mode Exit fullscreen mode
  • and in the $layout.svelte
<script>
  // import './global.pcss'
  import GlobalStyle from './GlobalStyle.svelte'

  // other code
</script>

<GlobalStyle/> <!-- call the component  -->
<main>
  <slot/>
</main>
Enter fullscreen mode Exit fullscreen mode

do the run build,, and,, BOOM!!! no error

please CMIIW

Collapse
 
eugenioclrc profile image
Eugenio

Why not inside the $layout.svelte?