matype/stylefmt

Line endings are not preserved

jakelauer opened this issue · 1 comments

test.zip

I would like my original line endings style to be preserved by postcss when using stylefmt. I have a file using the CR+LF line ending style ("\r\n"):

input

but when it is processed by postcss + stylefmt, those line endings are converted to just LF ("\n").

output

The zip file shows an example of input (file.css) and output (file-o.css).

My config file is as follows:

module.exports = {
	plugins: [
		require("stylefmt")({
			"extends": "stylelint-config-standard",
			"rules": {
				"at-rule-empty-line-before": "always",
				"block-closing-brace-newline-after": "always",
				"block-closing-brace-newline-before": "always",
				"block-opening-brace-newline-after": "always",
				"block-opening-brace-newline-before": "always",
				"declaration-colon-space-after": "always",
				"declaration-colon-space-before": "never",
				"indentation": "tabs",
				"length-zero-no-unit": true,
				"selector-combinator-space-after": "always",
				"selector-combinator-space-before": "always",
				"selector-list-comma-newline-after": "always",
				"selector-list-comma-newline-before": "never"
			}
		})
	]
}

and I am running via postcss-cli with the following command:

postcss -o file-o.css file.css --using postcss-scss

I just tried stylefmt on the command line and noticed my line endings \r\n were changed to \n. Came as a surprise.