sveltejs / svelte-preprocess

A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
MIT License
1.73k stars 147 forks source link

docs(updated link to compiler options for scss & sass) #542

Closed aarondiel closed 1 year ago

aarondiel commented 1 year ago

hint for where to find additional sass / scss compiler options.

this was very confusing for me, since the docs suggest that you can pass importers to the sass preprocessor and gave a different type definition from what svelte-preprocess expects.

taking the following code snippet from the current sass docs does not work:

preprocess({
  scss: {
    importers: [{
      // An importer that redirects relative URLs starting with "~" to
      // `node_modules`.
      findFileUrl(url) {
        if (!url.startsWith('~')) return null;
        return new URL(url.substring(1), pathToFileURL('node_modules'));
      }
    }]
  }
})

while something like this would:

preprocess({
  scss: {
    importer: (url) => {
      console.log(url)

      return {
        file: url
      }
    }]
  }
})

i hope this is only a temporary fix for when svelte-preprocess moves to a newer sass version

dummdidumm commented 1 year ago

Thank you! I added "move to new SASS API" to the list of the next major release planning (#504)