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

PostCSS doesn't run against @import url() local css. #605

Open
MadMaxMcKinney opened this issue Jul 2, 2023 · 1 comment
Open

PostCSS doesn't run against @import url() local css. #605

MadMaxMcKinney opened this issue Jul 2, 2023 · 1 comment

Comments

@MadMaxMcKinney
Copy link

Describe the bug
In my +layout.svelte root file I have this import statement for my global css

<style lang="postcss">
    @import url('../app.css');
</style>

However the imported css is not processed via PostCSS. If I directly in-line the css instead of importing it, PostCSS runs correctly.

Specifically concerned about nesting, here's my svelte.config

import adapter from '@sveltejs/adapter-auto'
import preprocess from 'svelte-preprocess';
import nesting from 'postcss-nesting'

/** @type {import('@sveltejs/kit').Config} */
const config = {
	// Consult https://kit.svelte.dev/docs/integrations#preprocessors
	// for more information about preprocessors
	preprocess: preprocess({
        postcss: {
            plugins: [nesting()]
        }
    }),
    kit: {
		adapter: adapter()
	}
};

Expected behavior
I'd like to keep my general css in it's own file, what is the best way to work here? I'd expect the imported css to be processed.

@pooledge
Copy link

pooledge commented Oct 2, 2023

Experiencing the same, but with a global import within script:

<script lang="ts">
	import '$styles/layout/index.scss';
</script>

I'm postcss'ing with mqpacker and sorting: true in order to get column widths working via placeholders, and the impact of this bug is quite big. Just not sure anymore where it started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants