2017-12-08 4 views
0

내가 백본을 사용하여 웹팩 응용 프로그램을 구축하고 내 CSS 파일은 트루 타입 글꼴을 사용하지만웹팩 3 및 CSS

import './css/style.css'; 

같은 라인 내 CSS를 가져올 시도하고있어에서 글꼴을 가져.

@font-face { 
    font-family: "Scramble"; 
    src: url(./scramble/Scramble.ttf) format("truetype"); 
} 

글꼴을 어디에서 찾을 수 있습니까? 다른 로더가 필요합니까?

은 현재 내가 얻을 :

Module not found: Error: Can't resolve './scramble/Scramble.ttf' 

답변

0

웹팩 자산의 종류를로드하는 방법을 알 필요가있다. npm install url-loader 그리고 일반적인 글꼴 파일 확장명을 해결하는 웹팩 구성에 아래 규칙을 추가하십시오.

rules : [ 
    { 
    test: /\.(woff|woff2|ttf|eot)$/, 
    use: [ 
     { 
     loader: 'url-loader', 
     options: { 
      limit: 10000, 
      mimetype: 'application/octet-stream' 
     } 
     } 
    ] 
    } 
// more rules 
]