-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
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
Add local statics for images and typefaces #3132
base: master
Are you sure you want to change the base?
Conversation
This solves issue naturalcrit#1958. Add static paths /staticImages and /staticFonts If a local environment is detected ( per existing loginc for login ) paths are added using the values in HB_IMAGES and HB_FONTS or the default values of /staticImages and /staticFonts respectively.
I only worked with the images part for now, but I couldn't get it to work? This is likely my fault, so I probably just need a little more guidance. I have pulled your PR here, confirmed that is what I am working with, and did In my brew, I did this: ![cat warrior](Class-Table-Frame.png)
![cat warrior](staticImages/Class-Table-Frame.png) And a couple of other variants. No dice. I then tried adding the I also tried simplifying that line down to: app.use(express.static('./staticImages')); Any tips? |
Those two url references would be relative to the current page location, and thus expanded to something like Try Here's an example of another image that should already work: |
Yeah I thought I tried that as well with no luck but I will try again later today. I had also tried changing the code to match what @G-Ambatte had suggested in the linked issue, and then following that format, to no avail. |
What happens if you right-click the broken image and say "open image in new tab" .. what does the window.location look like? |
I'm getting 406 responses when attempting to get a local image file, which appears to be from the content-negotiation middleware, That said, disabling said middleware does NOT result in the image being correctly served, so I suspect that there's still something that I've missed. |
In the buildHomebrew.js script: // Move assets
await fs.copy('./themes/fonts', './build/fonts');
await fs.copy('./themes/assets', './build/assets');
await fs.copy('./client/icons', './build/icons');
await fs.copy('./staticImages', './build/staticImages'); (note, this in the "themes" portion, which doesn't quite sit right with me...this is sort of out of my depth, though). and in app.js: // Add Static Local Paths
app.use(express.static('build/staticImages')); but it does require including the directory: ![alt](staticImages/image.png) duh, of course it works...it doesn't even need the app.js bit...because it's just referencing a directory in the build, which isn't anything special. So I guess....if someone is working locally, is there anything particularly wrong with just telling them to create a path Sorry, I think i've lost the thread. |
homebrewery/scripts/buildHomebrew.js Line 43 in c27f5d9
This line deletes the contents of I suspect that if we follow the recommendation below and use an absolute path to the |
Sorry, seem to have missed these questions. My read on the original request was this was desired for situations where the user probably does not want or cannot copy the static content into place or needs to point at a path outside of I've updated the initial commit comment to be a little more clear on usage. |
This solves issue #1958.
Add static paths /staticImages and /staticFonts
If a local environment is detected ( per existing loginc for login ), the paths are added via the configuration variables hb_fonts and hb_images, respectively.
These should be fully qualified paths.