javascript - Webpack load fonts -


i have code in react element:

require('../../style/fonts/somethingstrange.ttf') 

in webpack.config:

{ test: /\.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,        loader: 'file-loader?name=fonts/[name].[ext]' } 

problem: no font on webpages...

doesn't webpack let me automatically require fonts? have program else load fonts?

you have require fonts inside css files, not inside js/jsx files. example:

@font-face {     font-family: 'somethingstrange';     src: url('../../style/fonts/somethingstrange.ttf'); } 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -