Skip to content

Commit 7e2fa26

Browse files
committed
Update for Material Design Icon and Capitalize All Values
1 parent 08f87d2 commit 7e2fa26

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ <h1>Parse CSS and Convert to PHP Array</h1>
5757
<p>
5858
<small><a target="_blank" href="https://github.com/EmranAhmed/vue-generate-php-font-array">Github</a></small>
5959

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>
6161

6262
<small><a target="_blank" href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css">FontAwesome</a></small>
6363

script.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ new Vue({
2525

2626
var match,
2727
phpcode = [],
28-
$pattern = '.(' + prefix + '([^:|^"]+)):before',
28+
$pattern = `.(${prefix}([^:|^"]+)):before`,
2929
$regexp = new RegExp($pattern, "ig");
3030

3131
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+
}
3336
}
3437
return `<?php \nreturn array(\n${phpcode.join(",\n")}\n);`;
3538
}

0 commit comments

Comments
 (0)