I have set up a vue project using vue cli 3 and integrated Vuetify v2.0.19.
One of the requirements for my project is to be able to compile it into a single HTML file so that it can be downloaded and run offline in a phonegap app (specifically on Safari v13). While I've been successful in meeting most of the project's needs, one issue persists - the icons are not displaying correctly. Whenever I use
<v-icon>info</v-icon>
, for instance, instead of the icon rendering, it simply shows the word INFO.
I've followed the instructions provided in the Vuetify Quick-Start guide, Icons documentation, Browser Support resources, and numerous threads on Stack Overflow, but have yet to find a solution to this problem.
My main objective is to include the necessary fonts within the single build file. When loading the page on the phonegap app or serving it from the filesystem, I consistently receive 'not found' errors in the console like
(file:///D:/fonts/materialdesignicons-webfont.27cb2cf1.woff2)
. Although I understand that the path is incorrect, how can I ensure that the icons are part of the built file?
Is there a way to achieve this?
In order to generate the single html file with embedded js and css, I made use of npm packages such as html-webpack-plugin
and
html-webpack-inline-source-plugin
. Additionally, the following configurations were added to my vue.config.js
file:
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
module.exports = {
css: {
extract: false,
},
configureWebpack: {
optimization: {
splitChunks: false
},
plugins: [
new HtmlWebpackPlugin({
filename: 'output/output.html',
template: 'src/output-template.html',
inlineSource: '.(js|css)$' // embed all javascript and css inline
}),
new HtmlWebpackInlineSourcePlugin()
]
},
transpileDependencies:[/node_modules[/\\\\]vuetify[/\\\\]/]
}
Furthermore, in the src/plugins/vuetify.js
file:
import Vue from 'vue'
import Vuetify from 'vuetify/lib'
import '@mdi/font/css/materialdesignicons.css'
Vue.use(Vuetify)
export default new Vuetify({
icons: {
iconfont: 'mdi',
}
})