-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Css font path using relative build path #1284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm using // Template version: 1.3.1 |
Please try this: #1266 (comment) I wilkl look into this further at a later time. I'm very short on free time in the coming days, so it may be a while. |
Hi @LinusBorg thanks your help that does fix the path within the Css file, however now the files are emitted to the wrong folder. They are outputted to one level below /dist/ :( |
Damnit. This seems to be really tricky. Relative paths are of he devil :D |
yep, its a pain. Pretty sure postcss-url can solve this issue. I see you've added it to the project, maybe it just needs some additional config? |
Having the same issue here. The only thing I've changed from the default config is changing the assetsPublicPath: './', I include the fonts in the style tag of @font-face {
font-family: "Noto Sans SemCond";
src: local("Noto Sans SemiCondensed"), local("NotoSans-SemiCondensed"),
url("assets/fonts/subset-NotoSans-SemiCondensed.woff2") format("woff2");
font-weight: normal;
font-style: normal;
} The suggested fix by @LinusBorg from here does not work as well. Is there any way to include fonts in the production build? This seems like a pretty common use case. |
I had the exact same issue using the material-design-icons in this template. My dev configuration worked, but I had set prod to use relative paths. A valid workaround is described in issue 200 which has been open since July, 2016. The code for your webpack base font rule should be:
Incidentally, all I had to do the get material-design-icons working was |
Same here, need relative path for electron.js, some news about that ? |
I had the same issue. My development config worked, but my production build did not. Kept getting the wrong path for fonts. In my case, the dir structure was as below
I added the following line to the webpack base config file where it checks for font files. |
solved same issue with it, thanks @johnellinwood |
I'm just posting to mention this seems to be an actual issue with the webpack url-loader. While I do not use vuejs-templates (but certainly will in the future), I found this exact issue with one of my older React/Electron projects, then finding myself trying to figure out why my production builds were trying to access fonts using an exact development path. At the time of this writing I'm using Webpack 4.10.0, and url-loader 0.6.2. While I haven't tried 1.1.1 just yet, it's probably safe to say it doesn't change anything considering the last post was made 27 days ago in the referenced issue. Anyways, I thought I would mention this before anyone spent too much time trying to find the source of this issue in this particular project. |
I had the exact same issue, so, Just in case somebody is building a Cordova/Phonegap App with Vuej + Vuetify , I confirm the same work around worked for me. Thanks @johnellinwood !! |
Ive changed assetsPublicPath to a relative path.
All works fine except links to font files from css are broken. I've added fonts to my project under
/src/assets/fonts/myfont.woff
I've added them to app.vue like so
All works fine in dev. In production the font files are emitted to dist/static/fonts/ however within the css file the path is
Which causes the following path error in in the browser
Request URL:http://localhost/dist/static/css/static/fonts/HelveticaNeue.6f58d34.woff
Request Method:GET
Status Code:404 Not Found
The path in the css should be url(../fonts/
Is there a way to resolve this?
Something to do with postcss-url perhaps?
The text was updated successfully, but these errors were encountered: