-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Created scripts to update the current devicon.json and generate css files based on the new json file #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
amacado
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me @Thomas-Boi! :) I would suggest to clean up the artifacts, no longer required routines and change the build output to our known format "devicon.json" and "devicon.min.css" instead of your testing values.
I would also suggest that you provide a updated README.md on how to use the devicon.json in the future (and removing the alias.css and colors.css). Ok? :)
Maybe we should change the target branch to develop?
|
Hey @amacado, Thanks for looking at my change! I will address all of your suggestions in the next commit to the branch. Unfortunately, I am little busy with school right now so I will hopefully get it in by the weekends. I will also publish our discussions last week so everyone can see what we talked about as well. Cheers, |
|
Hey @amacado, I have removed all unnecessary files from the repo (test files, unneeded tasks) and rename the built files to Regarding the Cheers, |
Created scripts to update the current devicon.json and generate css files based on the new json file
Hello @amacado,
Here are the contents for this PR:
Summary:
upgradeDev.jswould create anewDevicon.jsonthat has thecolorandaliasesattributeupdateCssandcleanUpare used to create the css files.updateCsstask used Sass to help with creating thedevicon-alias.css, concatenation, and minification. We can remove the other gulp tasks that did these jobs.min.csscreated byupdateCssmight look weird but it works.mocha, clojure, clojurescript, redux, yunohost.The upgrade
devicon.jsonscript:upgradeDev.js. This is what it does:devicon.json,devicon-colors.cssand thedevicon-alias.css.deviconJsonin memorydeviconJsonto a new file callednewDevicon.json.contentMap.json: created fromdevicon.cssand maps a class name to thecontentpropertyaliasMap.json: created fromdevicon-alias.cssand maps the content property to an array of aliasescolorsMap.json: created fromdevicon-colors.cssand maps a class name to thecolorpropertyfontversion (aka no aliases) or acolorattribute. See line 137 to see the filter.dot-netin thenewDevicon.jsongenerated by the script doesn't have a color. This is due to the regexp that I used. It's faster if we just add the colors in manually afterwards, which is what I did for thenewDevicon.json`.The css-generating scripts:
devicon.jsonor in this case, thenewDevicon.json.devicon-colors.css, it generates css as read from thedeviconJson. It skips any objects that doesn't have a color or fonts.devicon-alias.css, it generates css for the aliases using the@extendsyntax from Sass. Whenever a selector@extendanother selector, Sass knows to generate the same css for both of them. You can see the result in themin.css.min.scsswhere it imports the above files. I then usegulpto process this file, creating themin.cssfile (the file extension.scssmeans a Sass file).cssfile. To see a minify version, go to line 37 and follow the instructions there. This means that we can remove thegulp-concatandgulp-minifydependencies.min.csshas thecontentproperty as squares (see below).This is fine and doesn't create a problem (see this). You can test it by:
index.htmllocated at the root dir.<link>that imports thedevicon.min.csshreftomin.cssYou can run this gulp task by typing
npm run build. For this task, I chaingulp taskstogether rather than using thegulp.series(). This is because of a weird bug:gulpfile.js, there's a task at the bottom calledtestwhich usesgulp.series(). Try running this task.min.cssis generated correctly and thecleanUp()removed all artifacts.min.scssfile is not found. The source of this is from a package calledduplexify, which might be fromgulporsass. In thecleanUp()function, I have tried changingunlink()toaccess()and things work fine (no errors).gulp.series()is only faster than&&chaining by a few seconds.Let me know what you think. Also, I'd need to clean up the branch before we merge it.