choffmeister / roboto-fontface-bower

Bower package for the Roboto font-face
Apache License 2.0
153 stars 57 forks source link

css paths to fonts and bower #46

Closed rainabba closed 6 years ago

rainabba commented 7 years ago

Personally, I only ever use bower to source files that I'll package in a taskrunner (I'm using Grunt at present) to spit out packaged files. The ../../fonts reference in the CSS files destroys this for me because my scripts get served from /css so the path to the fonts ends up being invalid. This could be easily addressed for both the current users and those like myself by either dropping the css/** subfolders (just flatten file names and you keep plenty of organization though I could imagine that makes the less/sass jobs a bit more tedious) OR (and I don't love this, but it would work) putting the font folder inside the css folder and in either case, update the paths to use only ../fonts

Essentially, I'm asking you to consider updating your file structure to accommodate what I think is a typical pattern of serving css from /css and fonts from /fonts OR css from /css and fonts from /css/fonts.

Something you'd consider doing? Would you take a PR to do this (updating any less/sass jobs as well of course).

rainabba commented 7 years ago

BTW, thank you for this project :)

Gusachenko commented 7 years ago

The same problem with ../../fonts structure. It can't find correct path from npm modules. Like example, structure can be similar material-design-icons module.

For now i mix local and network fonts:

@import url(~material-design-icons/iconfont/material-icons.css);
@import url(https://fonts.googleapis.com/css?family=Roboto:400,300);
fraulyoner commented 7 years ago

I'm not sure if I understand the problem, but maybe the following could be helpful for you?

I'm using SCSS to import the Roboto fontface to my project. I had to set the $roboto-font-path variable, else the fonts path in the generated CSS does not work in my project.

$roboto-font-path: "../lib/roboto-fontface/fonts";

@choffmeister: Maybe it would be useful to mention the $roboto-font-path variable in the README?

choffmeister commented 7 years ago

@rainabba Sorry for the delay, I am very distracted currently. I do not plan to change the folder structure. The relative path ../../../fonts is correct as long as one serves the files as they are. If you relocate files, then you can just change the path variable, as @fraulyoner pointed out.

@fraulyoner Yes adding the hint for the font-path variables to the README is a good idea. Can you provide a PR?

rainabba commented 7 years ago

No worries and thank you. The font-path idea mentioned by @fraulyoner only applies is one is processing CSS through an SCSS processor right? I don't presently use one and only know a little about them so I want to confirm what you guys might be taking for granted in that answer.

choffmeister commented 6 years ago

Will close this for now, since this is not a bug in this repo.

brunolm commented 6 years ago

With SASS

$roboto-font-path: '~roboto-fontface/fonts';
@import '~roboto-fontface/css/roboto/sass/roboto-fontface.scss';