Compare commits

..

2 Commits

Author SHA1 Message Date
swcs 26d8c5ec23 initial draft for SVG sprite generation 2021-07-09 14:36:00 +02:00
Lucide Bot 8ffb43b8e0 📦 Bump lucide package versions to 0.15.26 2021-07-07 11:20:52 +00:00
10 changed files with 83 additions and 14132 deletions
+5
View File
@@ -11,3 +11,8 @@ stats
*.log
packages/**/src/icons/*.js
packages/**/src/icons/*.ts
.pnp.js
.yarn
.yarn*
*.lock
package-lock.json
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "lucide-angular",
"description": "Lucide Angular package, Lucide is a community-run fork of Feather Icons, open for anyone to contribute icons.",
"version": "0.15.25",
"version": "0.15.26",
"author": "SMAH1",
"license": "ISC",
"homepage": "https://lucide.dev",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "lucide-preact",
"description": "Lucide Preact package, Lucide is a community-run fork of Feather Icons, open for anyone to contribute icons.",
"version": "0.15.25",
"version": "0.15.26",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "lucide-react",
"description": "Lucide React package, Lucide is a community-run fork of Feather Icons, open for anyone to contribute icons.",
"version": "0.15.25",
"version": "0.15.26",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "lucide-vue-next",
"version": "0.15.25",
"version": "0.15.26",
"author": "Eric Fennis",
"description": "Lucide Vue 3 Package",
"license": "ISC",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "lucide-vue",
"version": "0.15.25",
"version": "0.15.26",
"author": "Eric Fennis",
"description": "Lucide Vue Package",
"license": "ISC",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "lucide",
"description": "Lucide is a community-run fork of Feather Icons, open for anyone to contribute icons.",
"version": "0.15.25",
"version": "0.15.26",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
+36
View File
@@ -0,0 +1,36 @@
import fs from 'fs';
import path from 'path';
import getArgumentOptions from 'minimist'; // eslint-disable-line import/no-extraneous-dependencies
import transformsIconToSymbols from './render/transformsIconToSymbols';
import generateSpriteFile from './build/generateSpriteFile';
import { readSvgDirectory } from './helpers';
const cliArguments = getArgumentOptions(process.argv.slice(2));
const ICONS_DIR = path.resolve(__dirname, '../icons');
const OUTPUT_DIR = path.resolve(__dirname, cliArguments.output || '../build');
if (!fs.existsSync(OUTPUT_DIR)) {
fs.mkdirSync(OUTPUT_DIR);
}
const {
renderUniqueKey = false,
templateSrc = './templates/defaultIconFileTemplate',
silent = false,
iconFileExtention = '.js',
exportFileName = 'lucide.svg',
} = cliArguments;
const svgFiles = readSvgDirectory(ICONS_DIR);
const icons = transformsIconToSymbols(svgFiles, ICONS_DIR);
// Generates entry files for the compiler filled with icons exports
generateSpriteFile(
path.join(OUTPUT_DIR, 'sprite', exportFileName),
path.join(OUTPUT_DIR, 'sprite'),
icons
);
+36
View File
@@ -0,0 +1,36 @@
/* eslint-disable import/no-extraneous-dependencies */
import { basename } from 'path';
import { parseSync, stringify } from 'svgson';
import { generateHashedKey, readSvg, hasDuplicatedChildren } from '../helpers';
/**
* Build an object in the format: `{ <name>: <contents> }`.
* @param {string[]} svgFiles - A list of filenames.
* @param {Function} getSvg - A function that returns the contents of an SVG file given a filename.
* @returns {Object}
*/
export default (svgFiles, iconsDirectory) =>
svgFiles
.map(svgFile => {
const name = basename(svgFile, '.svg');
const svg = readSvg(svgFile, iconsDirectory);
const contents = parseSync(svg);
if (!(contents.children && contents.children.length)) {
throw new Error(`${name}.svg has no children!`);
}
if (hasDuplicatedChildren(contents.children)) {
throw new Error(`Duplicated children in ${name}.svg`);
}
return stringify({
name: 'symbol',
type: 'element',
attributes: {
id: name,
viewBox: contents.attributes.viewBox
},
children: contents.children
});
});
-14126
View File
File diff suppressed because it is too large Load Diff