mirror of
https://github.com/konpa/devicon.git
synced 2025-08-09 08:06:32 +02:00
Added extra artifact generation and logging function
This commit is contained in:
13
gulpfile.js
13
gulpfile.js
@@ -34,7 +34,9 @@ async function createDeviconMinCSS() {
|
||||
await fsPromise.writeFile(deviconMinPath, fileContent, "utf8");
|
||||
|
||||
return gulp.src(finalMinSCSSName)
|
||||
.pipe(sass.sync({"outputStyle": "compressed"}).on('error', sass.logError))
|
||||
// to get a minify version, uncomment line 38 and comment line 39
|
||||
// .pipe(sass.sync({"outputStyle": "compressed"}).on('error', sass.logError))
|
||||
.pipe(sass.sync().on('error', sass.logError))
|
||||
.pipe(gulp.dest('./'));
|
||||
}
|
||||
|
||||
@@ -66,12 +68,6 @@ async function createCSSFiles() {
|
||||
* created.
|
||||
*/
|
||||
function createAliasSCSS(deviconJson) {
|
||||
// let css = await fsPromise.readFile(
|
||||
// path.join(__dirname, "devicon.css"), "utf8"
|
||||
// );
|
||||
|
||||
// let statements = css.match(/\.devicon-(.*\s+){2,}?(?=})/g).map(str =>
|
||||
// createAliasesStatement(str, deviconJson));
|
||||
let statements = deviconJson.map(createAliasStatement).join(" ");
|
||||
let sass = `@use "devicon";${statements}`;
|
||||
let sassPath = path.join(__dirname, aliasSCSSName);
|
||||
@@ -119,10 +115,9 @@ function createColorsCSS(deviconJson) {
|
||||
} = fontObj;
|
||||
|
||||
if (fonts.length === 0 || typeof(color) !== "string") {
|
||||
console.log(name);
|
||||
console.log(`This object doesn't have a font or a color: ${name}`);
|
||||
return "";
|
||||
}
|
||||
// loop through the fonts and create css classes
|
||||
let cssClasses = fonts.map(font => `.devicon-${name}-${font}`);
|
||||
return `${cssClasses.join(",")}{color: ${color}}`;
|
||||
}).join(" ");
|
||||
|
@@ -14,12 +14,13 @@ function main() {
|
||||
let colorsMap = constructColorsMap();
|
||||
|
||||
// if you want to see what the maps are like
|
||||
// fs.writeFileSync(path.join(__dirname, "contentMap.json"),
|
||||
// JSON.stringify(contentMap), "utf8");
|
||||
// fs.writeFileSync(path.join(__dirname, "aliasMap.json"),
|
||||
// JSON.stringify(aliasMap), "utf8");
|
||||
// fs.writeFileSync(path.join(__dirname, "colorsMap.json"),
|
||||
// JSON.stringify(colorsMap), "utf8");
|
||||
// these maps are essential to create the final newDevicon.json
|
||||
fs.writeFileSync(path.join(__dirname, "contentMap.json"),
|
||||
JSON.stringify(contentMap), "utf8");
|
||||
fs.writeFileSync(path.join(__dirname, "aliasMap.json"),
|
||||
JSON.stringify(aliasMap), "utf8");
|
||||
fs.writeFileSync(path.join(__dirname, "colorsMap.json"),
|
||||
JSON.stringify(colorsMap), "utf8");
|
||||
|
||||
createNewDeviconJson(colorsMap, contentMap, aliasMap);
|
||||
}
|
||||
@@ -136,12 +137,12 @@ function createNewDeviconJson(colorsMap, contentMap, aliasMap) {
|
||||
|
||||
// run check to ensure every object has the needed attribute
|
||||
// log all fonts that are missing a color or don't have an array
|
||||
// let specialFont = newDeviconJson.filter(fontObj => {
|
||||
// return !(typeof(fontObj["color"]) === "string"
|
||||
// && Array.isArray(fontObj["aliases"]));
|
||||
// })
|
||||
let specialFont = newDeviconJson.filter(fontObj => {
|
||||
return !(typeof(fontObj["color"]) === "string"
|
||||
&& Array.isArray(fontObj["aliases"]));
|
||||
})
|
||||
|
||||
// console.log(specialFont);
|
||||
console.log(specialFont);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user