File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,36 +112,24 @@ module.exports = function(sSource) {
112112
113113 // 开始生成原子类
114114 aClassName . forEach ( item => {
115- let sKey ;
116-
117- let bColorFlag = oClassNameMap [ item . split ( '-' ) [ 0 ] ] && oClassNameMap [ item . split ( '-' ) [ 0 ] ] . indexOf ( '#' ) != - 1 ;
115+ let bColorFlag = oClassNameMap [ item . split ( '-' ) [ 0 ] ] && oClassNameMap [ item . split ( '-' ) [ 0 ] ] . indexOf ( '$' ) == - 1 && oClassNameMap [ item . split ( '-' ) [ 0 ] ] . indexOf ( '#' ) != - 1 ;
118116
119117 // 色值类
120118 if ( bColorFlag ) {
121- sKey = item . match ( / \. \w + / ) [ 0 ] ;
119+ let sKey = item . match ( / \. \w + / ) [ 0 ] ;
120+ let nValue = '#' + item . split ( '-' ) [ 1 ] ;
121+ aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] . replace ( / \# / g, nValue ) } }` ) ;
122122 }
123123 // 数值类
124124 else if ( / \d + / . test ( item ) ) {
125- sKey = item . match ( / \. \w + / ) [ 0 ] ;
125+ let sKey = item . match ( / \. \w + / ) [ 0 ] ;
126+ let nValue = + item . match ( / \d + / ) [ 0 ] ;
127+ aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] . replace ( / \$ / g, nValue ) } }` ) ;
126128 // 通用类
127129 } else {
128- sKey = item ;
129- }
130-
131- let nValue ;
132-
133- // 百分比数值,字重,无需使用单位
134- if ( [ '.wp' , '.hp' , '.fw' ] . includes ( sKey ) ) {
135- nValue = item . match ( / \d + / ) [ 0 ] ;
136- } else {
137- if ( bColorFlag ) {
138- nValue = '#' + item . split ( '-' ) [ 1 ]
139- } else {
140- / \d + / . test ( item ) && ( nValue = + item . match ( / \d + / ) [ 0 ] ) ;
141- }
130+ let sKey = item ;
131+ aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] } }` ) ;
142132 }
143-
144- aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] . replace ( / \$ | \# / g, nValue ) } }` ) ;
145133 } ) ;
146134
147135 return `'' + '${ aStyleStr . join ( '' ) } '` ;
Original file line number Diff line number Diff line change 11{
22 "name" : " miniprogram-atomcss-plugin" ,
3- "version" : " 1.0.5 " ,
3+ "version" : " 1.0.6 " ,
44 "homepage" : " https://github.com/wujr5/miniprogram-atomcss-plugin" ,
55 "repository" : {
66 "type" : " git" ,
Original file line number Diff line number Diff line change 1- .h-90{height:90rpx}.lh-90{line-height:90rpx}.h-30{height:30rpx}.lh-30{line-height:30rpx}.w-30{width:30rpx}. bgc-00ff00{background-color: #00ff00}.backcolor-00ff00{background-color: #00ff00}.c-ff00ff{color: #ff00ff}.c-123a6d{color: #123a6d}
1+ .h-90{height:90rpx}.lh-90{line-height:90rpx}.bgc-00ff00{background-color: #00ff00}.backcolor-00ff00{background-color: #00ff00}.c-ff00ff{color: #ff00ff}.c-123a6d{color: #123a6d}.bgred{background: red }
Original file line number Diff line number Diff line change 1- <view class="h-90 lh-90 bgc-00ff00 backcolor-00ff00 c-ff00ff c-123a6d c-ssdfsdf ">测试原子类</view>
1+ <view class="h-90 lh-90 bgc-00ff00 backcolor-00ff00 c-ff00ff c-123a6d bgred ">测试原子类</view>
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments