So, I’m trying to add special fonts (i.e. FontAwesome) to my website project, but no matter what it goes to the assets folder. I don’t want it like this since I can’t load the font unless it is in the project files, I believe.
Hi there @sakuu! So when I need an asset in my root app folder, I copy the Glitch CDN url of the file in Assets, open the terminal and go to the directory I want the file and then I run wget example-cdn-url.ttf
which will download the asset into that directory. It will have an ugly file name, but you can rename it by then running mv long-ugly-filename.ttf nice-file-name.ttf
. Hope that helps!
You can also use wget’s O switch for better files names:
wget cdn.glitch.com/file-abc.woff -O font.woff
You may also want to put the url in quotes.
Here’s the curl
version
curl cdn.glitch.com/file-abc.woff --output font.woff
Oh no… curl and wget battle has begins Just kidding!
Again, Let me give you a trick. Request the attachment URL and do something like this:
const fetch = require("node-fetch");
fetch("https://cdn.glitch.com/abdkdhsjdhejehdha").then(res => {
var stream = res.body;
// The fwesh stream is coming.....
// Do something fwesh with this incomming fwesh stream....
}).catch(console.error);
// Let's handle the promise rejection.
By the way, You can just import the Glitch CDN link at your CSS. Something like this:
body {
.... : url(https://cdn.glitch.com/abssbdbdiahdidhejs);
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.