prettier-style is a fool-like formatted styles tool, Support for any style of text content.
- Automatic sorting css declaration. use css-declaration-sorter. css-declaration-sorter
- Detection style specification. Use stylelint. stylelint
- Automatic repair style by stylelint rules.
Once you have configured stylelint (e.g. you have a .stylelintrc file), start with the following code. You will find additional configuration options below.
npm install prettier-style -D
prettier-style ./*.css --output=./
output
Output file folder path after formatting.skip-lint
Skip detection style specification.
body {
width: 100rpx;
margin-left: 48rpx;
border-radius: 16rpx;
height: 100rpx;
background-color: #fff;
position: relative;
box-shadow: 0 0 48rpx rgba(47, 53, 66, 0.2);
margin-right: 48rpx;
}
body {
position: relative;
width: 100rpx;
height: 100rpx;
margin-right: 48rpx;
margin-left: 48rpx;
border-radius: 16rpx;
background-color: #fff;
box-shadow: 0 0 48rpx rgba(47, 53, 66, 0.2);
}
use lint-staged
{
"lint-staged": {
"*.js": ["prettier --write", "git add"],
"*.css": ["prettier-style", "git add"]
}
}