From 030151d134d30575b0b0f8fdb5c64840e859ad51 Mon Sep 17 00:00:00 2001 From: Dan Leech Date: Sun, 26 Feb 2017 12:31:52 +0000 Subject: [PATCH] Adds CSS custom property file to the build script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/build.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/build.js b/src/build.js index f3bca1bc..addab24e 100644 --- a/src/build.js +++ b/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."); +});