vue-bulma / vue-admin

We are refactoring it, using the latest Vue and Bulma. WIP
9.43k stars 1.62k forks source link

Font assets generated path and referenced path don't match #176

Closed Caiyeon closed 7 years ago

Caiyeon commented 7 years ago

After running npm run build, the fonts are generated under public/assets/fonts However, when the webpage is served, the server tries to serve fonts from public/assets/css/assets/fonts

Changing frontend/build/webpack.base.conf.js query.name for font files will result in a change in both paths. In other words, changing query.name from utils.assetsPath('fonts/[name].[hash:7].[ext]') to utils.assetsPath('css/[name].[hash:7].[ext]') will result in fonts generated at public/assets/css/fonts and referenced at public/assets/css/assets/css, and does not solve the problem.

This issue does not occur when using npm run dev

netpi commented 7 years ago

hello @Caiyeon
I can't reproduce your problem . show your development environment

Caiyeon commented 7 years ago

I am running npm build to generate the built files, and then serving the entire generated folder with Golang Echo framework echo.Static("/", "public"). I can reproduce this on Windows, OSX, and Debian

Here's what it looks like: image

And chrome dev panel provides these errors: image

Mousing over the asset displays what the server is trying to serve the ttf file from: image

But as you know, the ttf files are not generated in assets/css/assets/fonts, they are generated in assets/fonts

netpi commented 7 years ago

it looks like this problem caused by your static server .
try with npm run start after npm run build

Caiyeon commented 7 years ago

@netpi start isn't a provided script in package.json Can you provide the command that it maps to?

netpi commented 7 years ago

@Caiyeon Sorry I forget npm run start have not yet configured

Caiyeon commented 7 years ago

image

It's still trying to serve fonts from /assets/css/assets/fonts/ @netpi This is on Windows 10, but it seems that the behaviour is independent of the server

Caiyeon commented 7 years ago

Fixed it. It seems I was missing this: https://github.com/vue-bulma/vue-admin/commit/6352f760af087f6e180f9495e4eb64f415716228#diff-b837e8e89bbf621827a64e0b2b0c0aa5

I had publicPath: isELECTRON ? path.join(__dirname, '../dist/') : '', in my repo instead of publicPath: isELECTRON ? path.join(__dirname, '../dist/') : '/',

Sorry for the inconvenience @netpi :)

netpi commented 7 years ago

😆 thank you @Caiyeon

BillGrim commented 7 years ago

Well, I meet the same problem as I set publicpath from isELECTRON ? path.join(__dirname, '../dist/') : '/' to isELECTRON ? path.join(__dirname, '../dist/') : './'. But my purpose is to change the absolute sourse request path (like /assets/js/) to relative path (like ./assets/js/) so that I can put all the files of vue-admin under /var/www/html/vue-admin/ instead of /var/www/html. So what files do I need to modify? Thanks.

BillGrim commented 7 years ago

@Caiyeon @netpi Hello, guys. Do you know how to deal with my problem?