CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Hello all,
I have been working on a script that would automate the build process of the icomoon.json and the fonts folder. I would like to merge it into the devicon repo so that it makes it easier to add new fonts.
Summary
The script would automate the tasks of using the Icomoon website. It will upload the icomoon.json, upload any svgs specified in an input.json (more on that), download the zip and extract the needed files. All of this is achieved using Selenium and Python.
input.json
The input.json determines which svgs would be added to the project. Here is how it works currently:
-
Merge pull request and put the new SVG folders into the icons folder
-
Go into input.json and enter the new fonts into it:
Format:
- Each new font will be a JSON object with the following properties:
- folderName {str}: the name of the new icon folder
- originalSameAsPlain {bool}: whether the original version can be
used for the plain version as well - color {str}: the color in hex for the colored version of the icon
Example:
- You have 2 new folders of svgs: A and B.
- A has an original version that's simple (aka plain) while B doesn't.
- A has a color of #123456 while B has a color of #654321
- So, in the input.json, you'd write:
- Each new font will be a JSON object with the following properties:
[
{
"folderName": "A",
"originalSameAsPlain": true,
"color": "#123456"
},
{
"folderName": "B",
"originalSameAsPlain": false,
"color": "#654321"
}
]
- When run, the script would read from this input.json, go to the folders specified, construct a path to the valid svgs (line, plain and maybe original versions), and upload it to Icomoon. This allows us to batch update the icomoon.json.
What is the 'color' attribute
Currently, we have a style.css
in order to have colored fonts. I plan to use the script to append new colored classes to the style.css. At the moment, this is still in the backlog because I wanted to explore whether we can add colors within the fonts itself. However, this seems like it would add a lot of complexity to the project (Icomoon said it'd create more complex fonts) so I think we might just keep using the css.
I want to test it first
Here's the link to my repo.
Everything should be there to test the script. You'd need to install Python and Selenium though.
Integration
Now that the script is functional, I would like to ask you for advice on how to integrate it to the devicon repo. Here are my suggestions:
- Turn the script into a command line script. This allows us to call it as an npm script.
- Update the README.md and the CONTRIBUTING.md to teach people how to use it. Split contributors into two groups: Uploaders who upload the SVGs and Builders who run the script and create the new icomoon.json.
OR
- Have a git branch specifically for building the icomoon.json. Uploaders can still upload but they won't have access to the build script. This creates 3 branches: a gh-pages branch for users to browse the icons, a master branch for user to upload icons, and a build branch for maintainer to build new icons.
I also have a NodeJS + Selenium version (not completed as the Python ver) which would do the same thing but I like the cleanliness of Python better.
What's next
If you guys accept the script, here are some areas that can be improved:
-Add functionality to append colored classes to style.css
-Make the browser runs on headless mode (so you don't have to sit and wait for the UI) or into a Docker image (which can runs in the background)
Feel free to leave any suggestions/comments