eanplatter/enclave

Added fonts?

codetony25 opened this issue ยท 18 comments

I'm trying to import some .otf fonts in my sass files and it gives me this error:

ERROR in ../css-loader!../sass-loader!/Users/tonynguyen/Desktop/codetony/src/styles/main.scss
Module not found: Error: Cannot resolve 'file' or 'directory' ../../assets/fonts/BebasNeue.otf in /Users/tonynguyen/Desktop/codetony/src/styles
@ ../css-loader!../sass-loader!/Users/tonynguyen/Desktop/codetony/src/styles/main.scss 6:19924-19967

I'm sure it's the correct path. however may I ask if we have this in the loader to support different types of font files?

Oh, as I expected: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)

So we don't have a loader that supports this just yet.

Yeah, I've never tried to load fonts with webpack before. Interesting problem. You can view the current loader config here

What loader do people normally use for otf files?

@eanplatter use

{
          test: /\.(otf|eot|ttf|woff)/,
          loader: 'url-loader?limit=8192'
        }

you don't have to process these files whats so ever, you just gotta load them via a simple url-loader

@goldensunliu or @tonytainguyen either of you interested in submitting a PR for this?

It looks good @goldensunliu

@eanplatter #50
have a good weekend bro.

@goldensunliu is url-loader a dep we need to install?

@eanplatter o yeah opps

Add it and I'll merge.

@eanplatter done, I prefer locking in version when using package.json

๐Ÿ‘ sounds good, thanks @goldensunliu

@eanplatter let me know how I can help. I will be watching :-D

Sounds good! Anything helps! Have a nice weekend!

Looks like there's gonna be a problem...
rp

When I npm install it doesn't install url-loader's dependency

This is easily fixed by adding file-loader to enclave's package.json