postcss-custom-properties icon indicating copy to clipboard operation
postcss-custom-properties copied to clipboard

Doesn't sequence with nano

Open MichaelRFox opened this issue 7 years ago • 1 comments

I am running nano and postcss-custom-properties, and on about every fourth or fifth build instead of replacing the custom properties in the target .css file, the entire .css file is replaced by the custom properties in my customProperties.json file.

I suspect that postcss-custom-properties is starting to execute before nano copies the .css files from my ./src directory, so finding no target .css file, merely creates a target .css file with a copy of the custom properties in my customProperties.json file.

The script from my package.json:

    "postcssTest": "postcss src/**/*.css -d test --config ./test",

My .postcssrc:

{
	"use": ["autoprefixer", "cssnano", "postcss-custom-properties"],
	"plugins": {
		"autoprefixer": {},
		"cssnano": {
			"preset": [
				"default",
				{"normalizeWhitespace": false}
			]
    	},	
    	"postcss-custom-properties": {
    		"preserve": false,
    		"importFrom": "./src/customProperties.json",
    		"exportTo": [
                "./test/breadcrumb.css",
                "./test/fyControl.css"
     		]
    	    }
	}
}

MichaelRFox avatar Dec 04 '18 12:12 MichaelRFox

I’m not sure what the issue is here, as postcss-custom-properties does not resolve asynchronously until all of the exports have been written.

Is there a chance this function is being executed again before it is complete? I’m unsure, myself.

jonathantneal avatar Dec 10 '18 13:12 jonathantneal