我的手是你的颜色,但我感到羞耻
佩戴一颗如此洁白的心。
——威廉·莎士比亚, 《麦克白》
莎士比亚不会满足于在 CSS 中使用“颜色”而不是“颜色”,你也不应该!他会认识到,这样做就体现了他写作的全部完整性。
使用postcss-spiffing
在任何地方使用正确的英式英语编写 CSS。
这与 muan 的spiffing
之间的主要区别在于,它与postcss
集成并且不使用正则表达式。
npm install postcss-spiffing --save-dev
/* Your well-spelt CSS */
body {
background-colour : grey;
transparency : 0.3 ;
text-align : centre;
text-transform : capitalise;
border : 1 px solid grey;
}
span {
font-weight : plump;
}
. frame {
background-photograph : url ( "/queen.png" ) !please;
}
. hello {
content : "subjects" ;
colour : grey;
}
将前往:
body {
background-color : gray;
opacity : 0.7 ;
text-align : center;
text-transform : capitalize;
border : 1 px solid gray;
}
span {
font-weight : bold;
}
. frame {
background-image : url ( "/queen.png" ) !important ;
}
. hello {
content : "subjects" ;
color : gray;
}
var postcss = require ( "postcss" ) ;
var spiffing = require ( "postcss-spiffing" ) ;
var fs = require ( "fs" ) ;
var css = fs . readFileSync ( "random.css" ) ;
console . log ( postcss ( spiffing ( ) ) . process ( css ) . css ) ;
要将其与gulp
一起使用,请使用 gulp-postcss。
colour
归color
plump
变成bold
capitalise
去capitalize
!please
转到!important
centre
到center
grey
变成gray
background-photograph
转到background-image
(也支持list-style-photograph
)transparency
变为opacity
(因为透明度与不透明度相反,所以变为 (1-n))storey
转到z-index
( ground
等于 1 等)