Skip to content

Commit

Permalink
Update convert.js
Browse files Browse the repository at this point in the history
Update classname and add remapper for invalid css classes thanks to @xjiro deb53cc
  • Loading branch information
1e4 authored Aug 25, 2022
1 parent 63e4cf2 commit 36800e8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@ let css = `

let html = `<head><title>Demo of Minecraft Items as CSS</title><link rel="stylesheet" href="./minecraft-items-spritesheet.css"></head><body>`;

const remap = {
'3d': '_3d',
'???': 'qqq'
};

for (const item in items) {
const i = items[item];
const row = (Math.floor(i.pos / 32)) - 1;
const column = Math.floor(i.pos % 32) - 1;
const className = item.toLowerCase().split(' ').join('-');
let className = item.toLowerCase().split(' ').join('-').replace("'", '').replace("(", '').replace(")", '').replace(".", '');

if (Object.keys(remap).includes(className)) {
className = remap[className];
}

css += `
.${className} {
--n:1; /* scale */
Expand Down

0 comments on commit 36800e8

Please sign in to comment.