We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently all the glyphs are contained in /public/vfx and referenced in code via
/public/vfx
import glyphs from './glyphs';
glyphs.js is a file storing an array of JSON objects:
glyphs.js
JSON
export const glyphs = [ { id: 1, src: "./vfx/glyphs/glyph1.png", description: "Earth" }, { id: 2, src: "./vfx/glyphs/glyph2.png", description: "Crater" }, ... { id: 39, src: "./vfx/glyphs/glyph39.png", description: "Leo" }, ]; export default glyphs;
For reasons beyond my comprehension, these files can't be held in /src because then importing doesn't work quite as well.
/src
import
The text was updated successfully, but these errors were encountered:
import is for static files only and images like glyph01.png theoretically can be changed in the future. So they can be held in /public/vfx/glyphs.
glyph01.png
/public/vfx/glyphs
If you have to do it, it will look like this:
import Img0 from '../images/0.png'; import Img1 from '../images/1.png'; import Img2 from '../images/2.png'; import Img3 from '../images/3.png'; import Img4 from '../images/4.png'; import Img5 from '../images/5.png'; import Img6 from '../images/6.png'; ...
Unless you will use webpack and use this code:
function importAll(r) { let images = {}; r.keys().map((item, index) => { images[item.replace('./', '')] = r(item); }); return images; } const images = importAll(require.context('./images', false, '/\.png/')); <img src={images['0.png']} />
The list of names (description) should be exported to increase legibility and ease of use in the future
Sorry, something went wrong.
alucard87pl#2 Exported description
8298fc0
From table to another variable for assembling in another function
Merge pull request #6 from Kuboczoch/master
e71d469
#2 Exported description
Closed and Resolved.
alucard87pl
No branches or pull requests
Currently all the glyphs are contained in
/public/vfx
and referenced in code viaglyphs.js
is a file storing an array ofJSON
objects:For reasons beyond my comprehension, these files can't be held in
/src
because thenimport
ing doesn't work quite as well.The text was updated successfully, but these errors were encountered: