有没有通用的工具或者方法可以把简写的css 转换成原始的css 比方说 border: 1px solid red 可以转换成 border-width: 1px; border-style: solid; border-color: red;
有没有通用的工具或者方法可以把简写的css 转换成原始的css 比方说 border: 1px solid red 可以转换成 border-width: 1px; border-style: solid; border-color: red;
border: 1px solid red
帮我转换成 详细的cssSure, here is the detailed CSS:
{
border-width: 1px;
border-style: solid;
border-color: red;
}
github copilot 的回答
自己用js写一个啊
function transformBorderStyle(borderStyleString){
const a = document.createElement('a')
a.style.border = borderStyleString
const { borderWidth,borderStyle,borderColor } = a.style;
return `border-width: ${borderWidth};border-style: ${borderStyle};border-color:${borderColor};`
}
10 回答11.3k 阅读
5 回答4.9k 阅读✓ 已解决
4 回答3.2k 阅读✓ 已解决
2 回答2.8k 阅读✓ 已解决
3 回答5.2k 阅读✓ 已解决
5 回答2k 阅读
1 回答3.4k 阅读✓ 已解决
https://github.com/johno/postcss-shorthand-expand
这个或许就是你想要的东西吧