Skip to content

Commit

Permalink
refactor: switch fro material icons to material symbols (#888)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin authored Mar 21, 2024
1 parent 49f39ff commit 7c25177
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 4,898 deletions.
68 changes: 1 addition & 67 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const log = require('consola');
const fs = require('fs');
const https = require('https');
const copyFiles = require('copyfiles');


require('@babel/register')({
presets: ['es2016'],
Expand All @@ -13,9 +11,6 @@ class Build {
this.dist = 'assets/dist/';
this.sass = 'source/sass/';
this.distCSS = `${this.dist}/css/`;
this.materialSCSS = `${this.sass}/material/`;
this.iconFont = './node_modules/material-design-icons-iconfont/dist/';
this.iconsMetadata =`assets/data/icons.json`;

this.handleFiles(processArgs);
}
Expand All @@ -27,8 +22,6 @@ class Build {
handleFiles(processArgs) {
if (processArgs === 'assets') {
this.makeDir();
} else if (processArgs === 'assetsMaterial') {
this.copyMoveFiles();
}
}

Expand All @@ -41,65 +34,6 @@ class Build {
log.info('Dist dir created');
}
}

/**
* Copy and move files
*/
copyMoveFiles() {


new Promise(
(resolve) => copyFiles(
[
`${this.iconFont}fonts/*`,
this.distCSS,
],
3,
resolve)
)
.then(() => {
log.success('Copy material design icon files to assets');
return new Promise((resolve) => {
copyFiles(
[
`${this.iconFont}material-design-icons.css`,
this.materialSCSS,
],
3,
resolve);
})
})
.then(() => {
return new Promise((resolve) => {
fs.rename(
`${this.materialSCSS}material-design-icons.css`,
`${this.materialSCSS}_material-icons.scss`,
resolve
);
})
})
.then(() => {
log.success('Changed format on css file to scss');
return new Promise((resolve) => {
https.get('https://fonts.google.com/metadata/icons', (response) => {
const file = fs.createWriteStream(this.iconsMetadata);
response.pipe(file);
file.on('finish', () => {resolve(file)});
});
})
})
.then((file) => {
return new Promise((resolve) => {
file.close();
let metadata = fs.readFileSync(this.iconsMetadata).toString().split('\n');
metadata.shift();
metadata = metadata.join('\n');
fs.writeFileSync(this.iconsMetadata, metadata);
log.success('Downloaded metadata file');
resolve();
})
})
}
}

new Build(process.argv[2]);
new Build(process.argv[2]);
1 change: 0 additions & 1 deletion build/sassComponents/componentTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports.sassTemplate = `
// ***************************************************************
// *** Settings
// ***************************************************************
@import "material/material-icons";
@import "../../setting/variables";
// ***************************************************************
Expand Down
Loading

0 comments on commit 7c25177

Please sign in to comment.