blonestar / wp-theme-vite-tailwind

Wordpress + ViteJS + TailwindCSS development example theme, similar to Tailpress but without additional code added
GNU General Public License v3.0
328 stars 58 forks source link

Failed to decode downloaded font #11

Open Dushyant1295 opened 1 year ago

Dushyant1295 commented 1 year ago

Hi I'm getting these issues with fonts in css

Failed to decode downloaded font

dev.local/:1 OTS parsing error: invalid sfntVersion: 154935620


@font-face {
  font-family: Mezius;
  src:
    url("./font/ppp.ttf") format('truetype');
  font-display: swap;
}

This is the vite config


import { defineConfig } from 'vite'
import liveReload from 'vite-plugin-live-reload'
const { resolve } = require('path')

export default defineConfig({
  plugins: [
    liveReload(__dirname + '/**/*.twig')
  ],
  root: '',
  base: process.env.NODE_ENV === 'development'
    ? '/'
    : '/dist/',
  build: {
    outDir: resolve(__dirname, './dist'),
    emptyOutDir: true,
    manifest: false,
    target: 'es2018',
    rollupOptions: {
      input: {
        main: resolve(__dirname + '/main.js')
      },
      output: {
        entryFileNames: `assets/[name].js`,
        chunkFileNames: `assets/[name].js`,
        assetFileNames: `assets/[name].[ext]`
      }
    },
    minify: true,
    write: true
  },
  server: {
    cors: true,
    strictPort: true,
    port: 3000,
    https: false,
    hmr: {
      host: 'localhost'
    },
  },
  resolve: {}
})
blonestar commented 1 year ago

Hi, It could be wrong path or bad font file. It should not have anything to do with Vite.

blonestar commented 1 year ago

Here is what ChatGPT says and recommend to check. https://chat.openai.com/share/5add2125-221e-4035-8cf3-04d711420b00