-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from osu-wams/update-icon-list
Update icon list
- Loading branch information
Showing
11 changed files
with
3,001 additions
and
5,279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import fetch from "node-fetch" | ||
|
||
const cliArguments = process.argv.slice(); | ||
const iconUrl = cliArguments.slice(2); | ||
|
||
/** | ||
* Parse the CSS | ||
* @param faIconUrl | ||
* @returns {Promise<RegExpMatchArray>} | ||
*/ | ||
async function getOsuIconNames(faIconUrl) { | ||
var iconNames = []; | ||
var response = await fetch(faIconUrl, { | ||
headers: { | ||
'Access-Control-Allow-Origin': '*' | ||
}, | ||
}); | ||
var data = await response.text(); | ||
|
||
// parse css to get icon names | ||
iconNames = data.match(/\.fa-[a-zA-Z0-9_-]*:/g); | ||
// trim css class names down to just the icon names | ||
iconNames.forEach((name, i) => { | ||
iconNames[i] = name.replace('.fa-', "").slice(0, -1); | ||
}); | ||
|
||
return iconNames; | ||
} | ||
|
||
const osuIconList = await getOsuIconNames(iconUrl[0]); | ||
osuIconList.sort(); | ||
osuIconList.forEach(iconName => { | ||
console.log(`'${iconName}',`); | ||
}); |
Oops, something went wrong.