Skip to content

Commit

Permalink
fix: split lucide icons and simplelogos
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Apr 13, 2024
1 parent 74a5729 commit 4b205f6
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 23 deletions.
10 changes: 4 additions & 6 deletions scripts/genicons.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs')
const path = require('path')

function buildIcons (iconsDir, output) {
function buildIcons (prefix, iconsDir, output) {
const icons = []
let css = ':root {\n'
fs.readdirSync(iconsDir).forEach(name => {
Expand All @@ -16,7 +16,7 @@ function buildIcons (iconsDir, output) {
})
css += '}\n'
icons.forEach(key => {
css += `.i-icon.${key}{--icon-url:var(--i-${key}-url)}\n`
css += `.i-${prefix}.${key}{--icon-url:var(--i-${key}-url)}\n`
})
fs.writeFileSync(output, css)
}
Expand Down Expand Up @@ -45,7 +45,5 @@ function encodeSvgForCss(svg) {
.replace(/>/g, '%3E');
}

const ICONS_SOURCE = path.resolve('static/icons')
const ICONS_OUTPUT = path.resolve('static/css/icons.css')

buildIcons(ICONS_SOURCE, ICONS_OUTPUT)
buildIcons('icon', path.resolve('static/icons'), path.resolve('static/css/icons.css'))
buildIcons('logo', path.resolve('static/logos'), path.resolve('static/css/logos.css'))
3 changes: 2 additions & 1 deletion static/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ strong, em {
border: 3px solid transparent;
}

.i-icon {
.i-icon,
.i-logo {
mask: var(--icon-url) no-repeat;
mask-size: 100% 100%;
width: 1em;
Expand Down
16 changes: 0 additions & 16 deletions static/css/icons.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4b205f6

Please sign in to comment.