File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ <h1>Parse CSS and Convert to PHP Array</h1>
57
57
< p >
58
58
< small > < a target ="_blank " href ="https://github.com/EmranAhmed/vue-generate-php-font-array "> Github</ a > </ small >
59
59
60
- < small > < a target ="_blank " href ="https://cdn.materialdesignicons.com/1.6.50 /css/materialdesignicons.min .css "> Material Design Icons</ a > </ small >
60
+ < small > < a target ="_blank " href ="https://cdn.materialdesignicons.com/1.7.22 /css/materialdesignicons.css "> Material Design Icons</ a > </ small >
61
61
62
62
< small > < a target ="_blank " href ="http://fontawesome.io/assets/font-awesome/css/font-awesome.css "> FontAwesome</ a > </ small >
63
63
Original file line number Diff line number Diff line change @@ -25,11 +25,14 @@ new Vue({
25
25
26
26
var match ,
27
27
phpcode = [ ] ,
28
- $pattern = '.(' + prefix + ' ([^:|^"]+)):before' ,
28
+ $pattern = `.( ${ prefix } ([^:|^"]+)):before` ,
29
29
$regexp = new RegExp ( $pattern , "ig" ) ;
30
30
31
31
while ( ( match = $regexp . exec ( css ) ) !== null ) {
32
- phpcode . push ( `\t'${ before } ${ match [ 1 ] } '=>'${ match [ 2 ] } '` ) ;
32
+ if ( match [ 1 ] . indexOf ( "." ) == - 1 || match [ 1 ] . indexOf ( "," ) == - 1 ) {
33
+ let name = match [ 2 ] . replace ( / - / g, ' ' ) . replace ( / ( \b \w ) / gi, function ( m ) { return m . toUpperCase ( ) ; } ) ;
34
+ phpcode . push ( `\t'${ before } ${ match [ 1 ] } '=>'${ name } '` ) ;
35
+ }
33
36
}
34
37
return `<?php \nreturn array(\n${ phpcode . join ( ",\n" ) } \n);` ;
35
38
}
You can’t perform that action at this time.
0 commit comments