I'm using fonts hosted on AWS S3 inside an SCSS file. So far that's worked with public S3 URLs but for security reasons, I need to remove all public URLs from client-side code. I was hoping to do something like
@font-face {
font-family: 'Helvetica';
font-style: normal;
font-weight: 400;
src: local('Helvetica'), local('Helvetica'),
url('<%= presigned_url("fonts/Helvetica.woff2") %>') format("woff2");
}
In this case, presigned_url would be a helper method that fetches the S3 object via the asset key (fonts/Helvetica.woff2), and returns a presigned URL that expires.
I've tried adding the .erb extension to my SCSS file but it doesn't seem to work. Is this possible? Or did I miss a step?