Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the tabler-icons library to v3.19.0 and update import-icons process. #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions import-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const fs = require('node:fs')

const prepareSvgFile = (svg) => {
return svg
.replace(/\n/g, '')
.replace(/>\s+</g, '><')
.replace(/<path stroke="none" d="M0 0h24v24H0z" fill="none"\s?\/>/, '')
;
.replace(/\n/g, '')
.replace(/>\s+</g, '><')
.replace(/<path stroke="none" d="M0 0h24v24H0z" fill="none"\s?\/>/, '')
;
}

const iconsPkg = require('./node_modules/@tabler/icons/package.json')
Expand All @@ -25,14 +25,17 @@ const generateIconsJSON = (jsonFile, filename) => {

for (let iconName in files) {
let iconData = files[iconName]

svgList.push({
name: iconName,
// version: iconData.version,
category: iconData.category,
tags: iconData.tags,
// unicode: iconData.unicode,
svg: prepareSvgFile(fs.readFileSync(`./node_modules/@tabler/icons/icons/${iconName}.svg`).toString())
Object.keys(iconData.styles).forEach(style => {
let name = iconName;
if (iconData.styles.filled) {
name += `_${style}`
}
svgList.push({
name: name,
category: iconData.category,
tags: iconData.tags?.filter(x => x).map(x => x.toString()) || [],
svg: prepareSvgFile(fs.readFileSync(`./node_modules/@tabler/icons/icons/${style}/${iconName}.svg`).toString())
})
})
}

Expand All @@ -42,4 +45,4 @@ const generateIconsJSON = (jsonFile, filename) => {
fs.writeFileSync(filename, JSON.stringify(svgData))
}

generateIconsJSON('./node_modules/@tabler/icons/tags.json', `./src/icons.json`)
generateIconsJSON('./node_modules/@tabler/icons/icons.json', `./src/icons.json`)
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"dependencies": {
"@create-figma-plugin/ui": "^3.1.0",
"@create-figma-plugin/utilities": "^3.1.0",
"preact": "^10.19.6"
"@create-figma-plugin/ui": "^3.2.1",
"@create-figma-plugin/utilities": "^3.2.1",
"preact": "^10.24.2"
},
"devDependencies": {
"@create-figma-plugin/build": "^3.1.0",
"@create-figma-plugin/tsconfig": "^3.1.0",
"@figma/plugin-typings": "1.88.0",
"@tabler/icons": "^2.47.0",
"@create-figma-plugin/build": "^3.2.1",
"@create-figma-plugin/tsconfig": "^3.2.1",
"@figma/plugin-typings": "1.100.2",
"@tabler/icons": "^3.19.0",
"fuse.js": "^7.0.0",
"typescript": "^5.3.3"
},
Expand Down
Loading