Skip to content

PostCSS plugins using the latest API won't load #22

@banjerluke

Description

@banjerluke

I cannot get melte to use postcss in <style> blocks load recent PostCSS plugin versions.

UPDATE: I finally figured out that it's something to do with using a plugin that's been updated for PostCSS 8. Downgrading the plugin, e.g., postcss-nested@4, makes everything work fine. I can't figure out how to edit melte-complier to make it compatible with the new plugin API, but for now at least I can just stick with older plugin versions.

Minimal reproduction

See also my repo with the results of these steps.

  1. meteor create --svelte
  2. meteor npm install --save-dev postcss postcss-load-config postcss-nested
  3. Create postcss.config.js to load postcss-nested plugin (like this)
  4. Set svelte:compiler's css option to false in package.json (like this)
  5. Add a <style lang="postcss"> block with a nested rule to App.svelte (like this)

Expected: postcss-nested plugin will transform the nested rule to proper CSS.

Actual: Build fails with imports/ui/App.svelte: Colon is expected (the exact error depends on the invalid CSS I've written)

Note: PostCSS works with .css files: If I put a nested rule in main.css it gets transformed properly. It only fails to transform CSS in .svelte files

Other things I've tried

  • Putting PostCSS config in package.json
  • Swapping out standard-minifier-css for juliancwirko:postcss
  • Setting css: true in svelte:compiler options
  • meteor reset
  • Doing this in my actual web app project
  • Setting the postcss option of svelte:compiler in package.json (see second post below)

Any ideas? I'm going crazy trying to get this to work. I love being able to use Svelte in Meteor, but it's been a drag to either write vanilla CSS or have to keep my styles in separate files. As I said above, this is working with older plugin versions now. Wish I could figure out how to update the package to be compatible with the most recent API, but I can't.

Thank you for looking! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions