Skip to content

Commit

Permalink
PNG +.MD
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvianen committed Jan 5, 2024
1 parent 1a72c57 commit 23b8eb4
Show file tree
Hide file tree
Showing 44 changed files with 73 additions and 172 deletions.
29 changes: 19 additions & 10 deletions bin/js/index.js

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

2 changes: 1 addition & 1 deletion bin/js/index.js.map

Large diffs are not rendered by default.

50 changes: 36 additions & 14 deletions bin/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
TypeScriptCompiler,
JavaScriptMinifier,
StylizedLogger,
// TemplateWriter,
TemplateWriter,
SvgToPngConverter,
gl_installer,
readPackageJson,
Expand Down Expand Up @@ -75,6 +75,7 @@ const CONFIG = {
ts_output: './dist/ts',
ts_output_icons: './src/ts/icons',
js_output: './dist/js',
jinja_input: './src/jinja',

},

Expand Down Expand Up @@ -138,16 +139,14 @@ async function main() {
const svgPackager = new SvgPackager(
path.join(CONFIG.path.root, 'bin/ts/config/svgo.config.js'),
);
try {
await svgPackager.processSvgFiles(
CONFIG.path.svg_input,
CONFIG.path.svg_output,
CONFIG.path.ts_output_icons,
CONFIG.path.json_output,
);
} catch (error) {
console.error('Failed to process SVG files:', error);
}

await svgPackager.processSvgFiles(
CONFIG.path.svg_input,
CONFIG.path.svg_output,
CONFIG.path.ts_output_icons,
CONFIG.path.json_output,
);



// PNG
Expand All @@ -158,13 +157,16 @@ async function main() {
const converter = new SvgToPngConverter();
const extractor = new FilenameExtractor();
const svg_paths = await directoryScanner.scanDirectory(CONFIG.path.svg_input, true)
await directoryCreator.createDirectories(CONFIG.path.dist, ['png']);

console.log(svg_paths);
// console.log(svg_paths);
for (const svg_path of svg_paths) {
console.log(svg_path);
if (path.extname(svg_path) == 'svg'){
// console.log(svg_path);
if (path.extname(svg_path) == '.svg'){
const filenameWithoutExtension = extractor.getFilenameWithoutExtension(svg_path);
const svgContent = await svgReader.readSVG(svg_path);
// console.log(filenameWithoutExtension);
// console.log(svgContent);
// Define the desired sizes for the PNG files
const sizes = [16, 32, 64, 128, 256, 512, 720];
for (const size of sizes) {
Expand Down Expand Up @@ -308,6 +310,26 @@ async function main() {
console.log('SVG Sprite generation completed.');



// MD Writer
// --------------------------------------------------------------------

logger.header('MD Writer');
const png_paths = await directoryScanner.scanDirectory(path.join(CONFIG.path.dist, 'png', '512'), true)
let png_names = []
for (const png_path of png_paths) {
if (path.extname(png_path) == '.png'){

let png_name = extractor.getFilenameWithoutExtension(png_path);
png_names.push(png_name);
}
}
const template_context = {
names: png_names,
}
const templater_md = new TemplateWriter(CONFIG.path.jinja_input, template_context);
await templater_md.generateToFile('icon.gl.md.jinja', path.join(CONFIG.path.dist, 'md', 'icon.gl.md'));

// SASS
// --------------------------------------------------------------------

Expand Down
5 changes: 5 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ Icon.gl is a modern, innovative icon library infused with the essence of traditi
- Cultural Heritage: Reflects the rich historical context of the Yaeyama Islands.
- Numerical Symbols: Incorporates unique numeral systems, influenced by Suzhou numerals.

| | | | | | |
| ---- | ---- | ---- | ---- | ---- | ---- |
| <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/pie_02.png" alt="pie_02"><small>pie_02</small> | <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/pie_03.png" alt="pie_03"><small>pie_03</small> | <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/star.png" alt="star"><small>star</small> | <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/swirl.png" alt="swirl"><small>swirl</small> | |


## Specifications

### Icon sizes
Expand Down
Binary file modified dist/font/icon.eot
Binary file not shown.
3 changes: 3 additions & 0 deletions dist/md/icon.gl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
| | | | | | |
| ---- | ---- | ---- | ---- | ---- | ---- |
| <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/pie_02.png" alt="pie_02"><small>pie_02</small> | <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/pie_03.png" alt="pie_03"><small>pie_03</small> | <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/star.png" alt="star"><small>star</small> | <img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/swirl.png" alt="swirl"><small>swirl</small> |
Binary file added dist/png/128/pie_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/128/pie_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/128/pie_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/128/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/128/swirl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/16/pie_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/16/pie_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/16/pie_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/16/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/16/swirl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/256/pie_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/256/pie_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/256/pie_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/256/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/256/swirl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/32/pie_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/32/pie_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/32/pie_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/32/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/32/swirl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/512/pie_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/512/pie_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/512/pie_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/512/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/512/swirl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/png/64/pie_01.png
Binary file added dist/png/64/pie_02.png
Binary file added dist/png/64/pie_03.png
Binary file added dist/png/64/star.png
Binary file added dist/png/64/swirl.png
Binary file added dist/png/720/pie_01.png
Binary file added dist/png/720/pie_02.png
Binary file added dist/png/720/pie_03.png
Binary file added dist/png/720/star.png
Binary file added dist/png/720/swirl.png
Binary file modified src/font/icon.eot
Binary file not shown.
9 changes: 9 additions & 0 deletions src/jinja/icon.gl.md.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
| | | | | | |
| ---- | ---- | ---- | ---- | ---- | ---- |
{% for name in names -%}
{% if loop.index0 % 6 == 0 %}
|
{%- else %}
<img src="https://raw.githubusercontent.com/scape-agency/icon.gl/main/dist/png/512/{{ name }}.png" alt="{{ name }}"><small>{{ name }}</small> |
{%- endif -%}
{% endfor %}
Loading

0 comments on commit 23b8eb4

Please sign in to comment.