Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

v12.0.0's env = development and preserve: false is not working. #256

Open
demonguyj opened this issue Sep 20, 2021 · 5 comments
Open

v12.0.0's env = development and preserve: false is not working. #256

demonguyj opened this issue Sep 20, 2021 · 5 comments

Comments

@demonguyj
Copy link

demonguyj commented Sep 20, 2021

pcss

@import "./_css/__function.pcss"; // :root

@import "./_css/common_content.pcss"; // contents

postcss.config

module.exports = (api) => ({
	plugins: {
		"postcss-import": {},
		"postcss-advanced-variables": {},
		"postcss-custom-properties": {
			preserve: false,
		},
        }
}

v11.0.0 env = development && preserve: false

#wrap_content {
	display: flex;
	font-size: 15px;
	flex-direction: column;
	justify-content: center;
}

#wrap_content,
#wrap_content.mbti1 {
	background-color: #6236ff;
}

but v12.0.0 env = development && preserve: false

:root {
	--purple: #6236ff;
}

#wrap_content {
	display: flex;
	font-size: 15px;
	flex-direction: column;
	justify-content: center;
}

#wrap_content,
#wrap_content.mbti1 {
	background-color: var(--purple);
}

I want to visible before result.

Because it's not working to ie 11.

Please check this please.

Thanks :)

@jonathantneal
Copy link
Member

Would you be able to provide a failing test or a reproduction somehow? 🥺

@demonguyj
Copy link
Author

demonguyj commented Sep 22, 2021

Okay. I reproduction my case.

Test and please ask any question.

Thanks :)

pcss

test.pcss
:root {
	--purple: #6236ff;
	--gray: #e9ebf3;
	--white: #fff;
	--black: rgba(0, 0, 0, 0.85);
	--resultBlack: #0f0f22;
	--resultPurple: #414b8f;
	--resultPurpleLight: #a1a9ff;
}

#wrap {
	&_content {
		display: flex;
		background-color: var(--purple);
		font-size: 15px;
		flex-direction: column;
		justify-content: center;
        }
}

config

module.exports = (api) => ({
	// `api.file` - path to the file
	// `api.mode` - `mode` value of webpack, please read https://webpack.js.org/configuration/mode/
	// `api.webpackLoaderContext` - loader context for complex use cases

	plugins: {
		"postcss-import": {},
		"postcss-advanced-variables": {},
		"postcss-custom-properties": {
			preserve: false,
		},
		"postcss-custom-selectors": {},
		"postcss-nested": {},
	},
})

setting

NODE_ENV=development

@dweidner
Copy link

dweidner commented Sep 30, 2021

I have a similar issue but independent from the environment I set. I use postcss-import as well. In postcss-custom-properties@10 everything worked as expected. In postcss-custom-properties@11 and postcss-custom-properties@12 it works only if I specify the corresponding files containing my custom properties via the importFrom option. If I include those files directly via an @import statement all custom properties remain within the document.

I think it is related to the file structure of a project. My main entry point is main.css which includes various files holding custom properties (e.g. settings.typography.css). If I include those custom properties directly in main.css everything is working as expected.

@dweidner
Copy link

dweidner commented Oct 1, 2021

Just noticed that this issues could be related to #204

@romainmenke
Copy link

@demonguyj Can you try with the latest version?
This might be fixed.

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

No branches or pull requests

4 participants