1

During the merger of several css need convert relative paths to absolute.

One of the steps - get realpath.

There Bootstrap with its css:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
       url('../fonts/glyphicons-halflings-regular.woff') format('woff'),
       url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),
       url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}

Result after realpath:

@font-face {
    font-family: "Glyphicons Halflings";
    src: url("/somepath/fonts/glyphicons-halflings-regular.eot");
    src: url("") format("embedded-opentype"),
         url("/somepath/fonts/glyphicons-halflings-regular.woff") format("woff"),
         url("/somepath/fonts/glyphicons-halflings-regular.ttf") format("truetype"),
         url("") format("svg");
}

For paths with params returned false.

How can get the realpath for path with params and save params?

lifecom
  • 11
  • 2

1 Answers1

0

Do you mean php's function "realpath" ? If that's the case, it's not meant to be used on url, but on file system paths.

If you want to use absolute paths for your fonts, it should start with a "/". ie : url("/css/fonts/glyphicons-whateveryoulike.ttf")

The "/" at the beginning will be the root of your web directory.

Chibani
  • 770
  • 4
  • 8
  • Steps of css-merge ~: if _preg_math_all_(url) -> exclude _substr_(protocol and data:) -> realpath -> get webpath – lifecom May 26 '15 at 20:19