Answer the question
In order to leave comments, you need to log in
How to properly embed both css and fonts in a js file?
I am writing a small widget in vue. One of the requirements is that just 1 js file should be connected.
I.e. Here I have markup in the components, I use my own font and pictures. I overtook the pictures in base64 and no problems. But with styles and fonts (which are called in styles. Already a problem.
I tried it like this:
<style>
@import "../../sass/app.scss";
</style>
mix.webpackConfig({
resolve: {
modules: [
path.resolve(__dirname, 'vendor/laravel/spark/resources/assets/js')
]
}
});
let mix = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.version();
Answer the question
In order to leave comments, you need to log in
Fonts are sealed using base64:
@font-face {
font-family: 'MyWebFont';
src:
url(data:application/x-font-woff;base64,КОД_ТВОЕГО_ШРИФТА==) format('woff'),
....
}
document.getElementById("что-то").innerHTML="<style>твой-css</style>";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question