File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ module.exports = function(sSource) {
169
169
aClassName . forEach ( item => {
170
170
let sKey ;
171
171
172
- let bColorFlag = oClassNameMap [ item . split ( '-' ) [ 0 ] ] && oClassNameMap [ item . split ( '-' ) [ 0 ] ] . indexOf ( '#' ) != - 1 ;
172
+ let bColorFlag = oClassNameMap [ item . split ( '-' ) [ 0 ] ] && oClassNameMap [ item . split ( '-' ) [ 0 ] ] . indexOf ( '$' ) == - 1 && oClassNameMap [ item . split ( '-' ) [ 0 ] ] . indexOf ( ' #') != - 1 ;
173
173
174
174
// 色值类
175
175
if ( bColorFlag ) {
@@ -188,15 +188,16 @@ module.exports = function(sSource) {
188
188
// 百分比数值,字重,无需使用单位
189
189
if ( [ '.wp' , '.hp' , '.fw' ] . includes ( sKey ) ) {
190
190
nValue = item . match ( / \d + / ) [ 0 ] ;
191
+ aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] } }` ) ;
191
192
} else {
192
193
if ( bColorFlag ) {
193
- nValue = '#' + item . split ( '-' ) [ 1 ]
194
+ nValue = '#' + item . split ( '-' ) [ 1 ] ;
195
+ aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] . replace ( / \# / g, nValue ) } }` ) ;
194
196
} else {
195
197
/ \d + / . test ( item ) && ( nValue = + item . match ( / \d + / ) [ 0 ] ) ;
198
+ aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] . replace ( / \$ / g, nValue ) } }` ) ;
196
199
}
197
200
}
198
-
199
- aStyleStr . push ( `${ item } {${ oClassNameMap [ sKey ] . replace ( / \$ | \# / g, nValue ) } }` ) ;
200
201
} ) ;
201
202
202
203
// 输出 debug 数据
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-atomcss-loader" ,
3
- "version" : " 1.1.7 " ,
3
+ "version" : " 1.1.8 " ,
4
4
"description" : " 基于 vue 的按需生成原子类样式的 loader" ,
5
5
"homepage" : " https://github.com/wujr5/vue-atomcss-loader" ,
6
6
"repository" : {
You can’t perform that action at this time.
0 commit comments