Config.rb for SASS fonts directory path add slash

I installed the config.rb file below

http_path = "/" css_dir = "" sass_dir = "sass" images_dir = "images" fonts_dir = 'fonts' fonts_path = "" javascripts_dir = "js" 

Here is my directory path

At the root of the project

style.css Fonts / My-fonts insolence /style.sass images / My-all-images

Now, when I try to add fonts using font-face, it adds a leading slash for the font directory, for example /fonts , but I only want fonts

Sass

 +font-face("Ubuntu", font-files("ubuntu/ubuntu-r-webfont.eot", "ubuntu/ubuntu-r-webfont.eot?#iefix", "ubuntu/ubuntu-r-webfont.woff", "ubuntu/ubuntu-r-webfont.ttf", "ubuntu/ubuntu-r-webfont.svg#ubunturegular")) 

CSS creation

 @font-face { font-family: "Ubuntu"; src: url('/fonts/ubuntu/ubuntu-r-webfont.eot') format('embedded-opentype'), url('/fonts/ubuntu/ubuntu-r-webfont.eot?#iefix') format('embedded-opentype'), url('/fonts/ubuntu/ubuntu-r-webfont.woff') format('woff'), url('/fonts/ubuntu/ubuntu-r-webfont.ttf') format('truetype'), url('/fonts/ubuntu/ubuntu-r-webfont.svg#ubunturegular') format('svg'); } 
+4
source share
2 answers

You can set relative_assets = true right after setting the path in the configuration file.

Here is an example configuration example for working with relative assets.

 # Set this to the root of your project when deployed: http_path = "/" css_dir = "app/css" sass_dir = "app/css/sass" images_dir = "app/img" javascripts_dir = "app/js" fonts_dir = "app/css/fonts" output_style = :nested environment = :development relative_assets = true 
+10
source
 You can set http_fonts_path = "fonts" right after path setting in config file. Here is a sample config example to work. # Set this to the root of your project when deployed: http_path = "/" css_dir = "css" sass_dir = "scss" images_dir = "images" javascripts_dir = "js" http_fonts_path = "fonts" 
0
source

Source: https://habr.com/ru/post/1497387/


All Articles