-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0316666
commit 7e429c5
Showing
2,072 changed files
with
1,744 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const iconsfolders = ['./resources/icons/outline', './resources/icons/solid']; | ||
const iconsfolders = [ | ||
{ type: 'outline', path: './resources/icons/heroicons/outline' }, | ||
{ type: 'solid', path: './resources/icons/heroicons/solid' }, | ||
{ type: 'fa-brands', path: './resources/icons/fa/free/brands' }, | ||
{ type: 'fa-regular', path: './resources/icons/fa/free/regular' }, | ||
{ type: 'fa-solid', path: './resources/icons/fa/free/solid' }, | ||
]; | ||
let files = []; | ||
iconsfolders.forEach((folder) => { | ||
const folderFiles = fs.readdirSync(folder).map((fileName) => path.join(folder, fileName)); | ||
const { type } = folder; | ||
const folderFiles = fs.readdirSync(folder.path).map((fileName) => ({ | ||
type, | ||
path: path.join(folder.path, fileName), | ||
})); | ||
files = [...folderFiles, ...files]; | ||
}); | ||
// eslint-disable-next-line no-shadow | ||
const data = files.map((path) => { | ||
const type = path.split('/').reverse()[1]; | ||
const name = path.split('/').reverse()[0].replace('.svg', ''); | ||
const content = fs.readFileSync(path, 'utf-8'); | ||
const data = files.map((file) => { | ||
const { type } = file; | ||
const name = file.path.split('/').reverse()[0].replace('.svg', ''); | ||
const content = fs.readFileSync(file.path, 'utf-8').replace(/<!--(.*?)-->/gm, ''); | ||
return { type, name, content }; | ||
}); | ||
fs.writeFile( | ||
'./resources/js/icons.js', | ||
`export const icons = ${JSON.stringify(data)}`, | ||
(err) => { | ||
if (err) { | ||
// eslint-disable-next-line no-console | ||
console.error('Crap happens'); | ||
} | ||
}, | ||
); | ||
fs.writeFile('./resources/js/icons.js', `export const icons = ${JSON.stringify(data)}`, (err) => { | ||
if (err) { | ||
// eslint-disable-next-line no-console | ||
console.error('Crap happens'); | ||
} | ||
}); | ||
// eslint-disable-next-line no-console | ||
console.log('\x1b[32m./resources/js/icons.js successfully generated.\x1b[0m'); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.