mirror of
https://github.com/Mibew/simple-icons.git
synced 2025-01-17 23:51:08 +03:00
Adds CSS custom property file to the build script
This will regenerate the CSS file automatically when the build script is run. This way we don’t have to manually maintain lists of variables whenever icons are added or changed.
This commit is contained in:
parent
ce95cff89f
commit
030151d134
12
src/build.js
12
src/build.js
@ -117,6 +117,7 @@ fs.writeFile("../404.html", htmlOutput, function(err) {
|
||||
|
||||
var sass = "// Brand colours from simpleicons.org\n";
|
||||
var less = "// Brand colours from simpleicons.org\n";
|
||||
var css = "/* Brand colours from simpleicons.org */\n\n:root {";
|
||||
var maxNameLength = 0;
|
||||
|
||||
for (var i = 0; i < source.icons.length; i++) {
|
||||
@ -153,8 +154,11 @@ for (var i = 0; i < source.icons.length; i++) {
|
||||
|
||||
sass += "\n$color-brand-" + fileName.toLowerCase() + ": " + spacing + "#" + source.icons[i].hex.toUpperCase() + ";";
|
||||
less += "\n@color-brand-" + fileName.toLowerCase() + ": " + spacing + "#" + source.icons[i].hex.toUpperCase() + ";";
|
||||
css += "\n --color-brand-" + fileName.toLowerCase() + ": " + spacing + "#" + source.icons[i].hex.toUpperCase() + ";";
|
||||
}
|
||||
|
||||
css += "\n}";
|
||||
|
||||
// Generate Sass file with colour variables
|
||||
fs.writeFile("../colour-variables.scss", sass, function(err) {
|
||||
if(err) {
|
||||
@ -170,3 +174,11 @@ fs.writeFile("../colour-variables.less", less, function(err) {
|
||||
}
|
||||
console.log(" - brand-colours.less built successfully.");
|
||||
});
|
||||
|
||||
// Generate CSS file with colour variables
|
||||
fs.writeFile("../colour-variables.css", css, function(err) {
|
||||
if(err) {
|
||||
return console.log(err);
|
||||
}
|
||||
console.log(" - brand-colours.css build successfully.");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user