fontfacegen webpack plugin
1.0.0
이 플러그인을 사용하면 .ttf 및 .otf 파일을 기존 NPM 패키지 fontfacegen 사용하여 .eot, .ttf, .svg, .woff 및 .woff2와 같은 다양한 다른 글꼴 형식으로 변환 할 수 있습니다.
fontfacegen
fontfile.ttf ---------------> fontfile.ttf
fontfile.eot
fontfile.svg
fontfile.woff
fontfile.woff2
npm install fontfacegen
npm install fontfacegen-webpack-plugin
모듈 fontfacegen-webpack-plugin 필요하고 FontfacegenWebpackPlugin 의 인스턴스를 만들고 인스턴스를 플러그인 어레이로 전달하십시오.
const FontfacegenWebpackPlugin = require ( 'fontfacegen-webpack-plugin' )
module . exports = {
entry : 'index.js' ,
output : {
path : 'dist' ,
filename : 'index_bundle.js'
} ,
plugins : [
new FontfacegenWebpackPlugin ( { tasks : [ 'fontfile.ttf' , 'anotherfont.otf' ] } )
]
}다음 파일이 생성됩니다.
dist/fontfile.eotdist/fontfile.ttfdist/fontfile.svgdist/fontfile.woffdist/fontfile.woff2dist/anotherfont.eotdist/anotherfont.ttfdist/anotherfont.svgdist/anotherfont.woffdist/anotherfont.woff2그런 다음 코드 에서이 파일을 참조 할 수 있습니다.
@font-face {
src : url ( "dist/fontfile.eot" );
src : url ( "dist/fontfile.eot?#iefix" ) format ( "embedded-opentype" ) ,
url ( "dist/fontfile.woff2" ) format ( "woff2" ) ,
url ( "dist/fontfile.woff" ) format ( "woff" ) ,
url ( "dist/fontfile.ttf" ) format ( "ttf" ) ,
url ( "dist/fontfile.svg" ) format ( "svg" );
font-family : fontfile;
font-style : normal;
font-weight : normal;
}
@font-face {
src : url ( "dist/anotherfont.eot" );
src : url ( "dist/anotherfont.eot?#iefix" ) format ( "embedded-opentype" ) ,
url ( "dist/anotherfont.woff2" ) format ( "woff2" ) ,
url ( "dist/anotherfont.woff" ) format ( "woff" ) ,
url ( "dist/anotherfont.ttf" ) format ( "ttf" ) ,
url ( "dist/anotherfont.svg" ) format ( "svg" );
font-family : anotherfont;
font-style : normal;
font-weight : normal;
} fontfacegen-webpack-plugin 모듈 기본값은 단일 클래스 : FontfacegenWebpackPlugin 내 보냅니다
이 객체의 인스턴스는 웹 팩의 구성 옵션의 플러그인 어레이로 전달됩니다.
생성자는 객체를 첫 번째 인수로 간주합니다.
| 재산 | 설명 |
|---|---|
| 작업 | 디렉토리 또는 파일 경로 배열. |
- 디렉토리 : 디렉토리의 확장자 .ttf 및 .otf 가있는 파일이 변환됩니다. | |
| - 파일. 해당 단일 파일은 변환됩니다. | |
| 서브 세트 | 생성 된 글꼴 내부에 포함되기를 원하는 문자가있는 문자열 또는 배열. |
기여하는 가장 쉬운 방법은 Github 에이 프로젝트를 주연시키는 것입니다!
https://github.com/daniel-araujo/fontfacegen-webpack-plugin
버그를 발견하거나 기능을 제안하거나 도움이 필요하다면 Github에서 문제를 자유롭게 만들 수 있습니다.
https://github.com/daniel-araujo/fontfacegen-webpack-plugin/issues