TehShrike / svelte-preprocess-postcss

Use PostCSS to preprocess your styles in Svelte components
25 stars 4 forks source link

Postcss Syntax Tag #13

Open Pedroglp opened 4 years ago

Pedroglp commented 4 years ago

I think the syntax tag is not currently being passed forward to postcss processor.

ie:

// postcss.config.js
module.exports = {
  syntax: 'postcss-scss',
  plugins: {
    …
  }
}
//webpack.config.js
    module: {
        rules: [
            {
                test: /\.svelte$/,
                use: {
                    loader: 'svelte-loader',
                    options: {
                        preprocess: {
                            style: sveltePreprocessPostcss({
                                configFilePath: './postcss.config.js',
                                useConfigFile: true,
                            })
                        },
                        emitCss: true,
                        hotReload: true
                    }
                }
            },

Error:

image

image

Options object is not used.

This makes a little bit harder to use syntax plugins like: postcss-less, postcss-sass, postcss-scss.

TehShrike commented 4 years ago

The PostCSS processor does not take a "syntax" argument.

https://github.com/postcss/postcss#js-api

Where do you expect that string to get used?

Pedroglp commented 4 years ago

Yes it does, but it is not documented:

image

https://github.com/postcss/postcss/blob/master/lib/postcss.d.ts

Pedroglp commented 4 years ago

Yes it does, but it is not documented:

image

https://github.com/postcss/postcss/blob/master/lib/postcss.d.ts

TehShrike commented 4 years ago

Ah, you're talking about the options argument. That is documented: https://github.com/postcss/postcss#options

I opened a PR #14 that should probably fix this, but I haven't tested it. Could you install that pass-options-to-processor branch and test it locally to make sure it works, and fixes your issue?