Fonts changing font-display inside @face #9147
Replies: 4 comments
-
|
I was wondering the exact same thing. Would be nice if someone could answer. Any quasar devs can answer ? or tell us if it will be possible in the near future ? Thanks 😃 |
Beta Was this translation helpful? Give feedback.
-
|
+1 reference link : https://web.dev/font-display/ |
Beta Was this translation helpful? Give feedback.
-
|
One way to do it is to use a webpack loader. I just tested it for Roboto fonts and it works great. Install the string-replace-loader webpack loader: yarn add --dev string-replace-loaderThen, add it to your webpack configuration in your {
build: {
chainWebpack(chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js', 'vue'] }]);
chain.module
.rule('roboto-font')
.test(/@quasar\/extras\/roboto-font\/roboto-font\.css$/)
.use('string-replace')
.loader('string-replace-loader')
.options({
search: 'font-family: \'Roboto\';',
replace: 'font-family: \'Roboto\';\n font-display: swap;',
flags: 'g',
})
.after('css-loader');
},
}
} |
Beta Was this translation helpful? Give feedback.
-
|
Are there any solution using the vite setup? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys,
i'm just optimizing my app and i wanted to know if theres any way i can just add like
@font-face { font-display: swap; }without overriding the previous @font-face settings used while using the roboto and fontawesome extras.
Best regards, Rob.
Beta Was this translation helpful? Give feedback.
All reactions