Skip to content
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

CSS preprocessor - font assets outside of src #4031

Closed
awolfe76 opened this issue Feb 15, 2018 · 2 comments
Closed

CSS preprocessor - font assets outside of src #4031

awolfe76 opened this issue Feb 15, 2018 · 2 comments

Comments

@awolfe76
Copy link

This is a question, not a bug report.

I'm looking for a little help when it comes to using a CSS preprocessor. I followed the instructions for Sass and everything works as advertised. 👍

My problem is that the framework I'm required to use also includes fonts, and when it imports those fonts it does so like this:

@font-face {
  font-family: "Source Sans Pro";
  font-style: normal;
  font-weight: 400;
  src: url("../fonts/sourcesanspro-regular-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/sourcesanspro-regular-webfont.woff2") format("woff2"), url("../fonts/sourcesanspro-regular-webfont.woff") format("woff"), url("../fonts/sourcesanspro-regular-webfont.ttf") format("truetype"); }

So when I run a build I see
Module not found: Error: You attempted to import ../fonts/sourcesanspro-light-webfont.eot which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

That all makes sense.


I'm curious to know if you've seen something like this before and have a work around for it. I've tried adding a few extra scripts to copy the fonts directory from node_modules into src but of course that doesn't help because the @font-face is still going outside of src.

I can attempt another workaround by only including the .scss that I want from the framework (excluding the fonts) and downloading the fonts and checking them into my repo in the public directory, but wanted to see if I was missing an obvious solution first.

Thanks!

@Timer
Copy link
Contributor

Timer commented Apr 15, 2018

Sass support will be released in 2.0 (fyi), and the best advice I can give you is just to move your fonts/ folder into src/ -- I'm sorry if this isn't the most terribly helpful answer, but it's our typical response.

Since you require some path trickery, you might have to do the following:

src/assets/css/yourcss.css
src/assets/fonts # the copied fonts

Is there a reason you don't want them in your src/ folder?

@Timer Timer closed this as completed Apr 15, 2018
@SeanFelipe
Copy link

I'm in a similar situation, and first thought was to not have them in the src/ directory since they would seem to be more binary assets than text source code.

@lock lock bot locked and limited conversation to collaborators Jan 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants