Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#17243 closed defect (fixed)

Custom build with css font-face SVG font produces error 357, impossible to resolve

Reported by: wskidmore Owned by: Rawld Gill
Priority: high Milestone: 1.8.6
Component: BuildSystem Version: 1.9.0
Keywords: Cc:
Blocked By: Blocking:

Description

When including a svg font in CSS via font face you must include a hash with the id of the font:

@font-face {
   font-family: 'myfont';
   src: url('../fonts/myfont.eot') format('embedded-opentype'),
      url('../fonts/myfont.woff') format('woff'),
      url('../fonts/myfont.ttf')  format('truetype'),
      url('../fonts/myfont.svg#myfont') format('svg');
}

When doing a custom build it stores a reference to the full path of all resources in buildControlBase in a object map called resourcesByDest. The above svg font resource would be stored as:

C:\app\content\fonts\myfont.svg

When the optimizeCSS runs it expands the relative URL to the full path and does a lookup to the resourcesByDest, if its not a found it produces a "impossible to resolve" error 357.

The issue here is its attempting to find resourcesByDest['C:\app\content\fonts\myfont.svg#myfont'] and failing, even though the font is there.

Using dojo/util tagged for 1.9.0rc2, which after the git shuffle is as of this commit: https://github.com/dojo/util/commit/74489ac9ebf12ecace2ee39570f659b7d8f50497

Attachments (1)

17243-test.zip (1.8 KB) - added by Ed Hager 6 years ago.
Test environment for my fix

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by Ed Hager

I have a fix for this ticket: https://github.com/dojo/util/pull/11

There is a test for the CSS optimizer (buildscripts/tests/css/flattenTest.js) but it is old and is looking for jslib/buildUtil.js which has long been deleted. So I am attaching a zip file that contains the build profile and css files I used to test the fix.

Changed 6 years ago by Ed Hager

Attachment: 17243-test.zip added

Test environment for my fix

comment:2 Changed 6 years ago by Ed Hager

If you decide to apply my fix, can it be applied to the 1.8 branch as well as 1.9 and master? The 1.8 branch contains unreleased code that handles the query string.

Last edited 6 years ago by Ed Hager (previous) (diff)

comment:3 Changed 6 years ago by Bryan Forbes

Owner: set to Rawld Gill
Status: newassigned

comment:4 Changed 6 years ago by Bryan Forbes

Priority: undecidedhigh

comment:5 Changed 6 years ago by Colin Snover

Milestone: tbd1.8.6
Resolution: fixed
Status: assignedclosed

Hooks are broken…

Fixed in cbe848ad3948f4a14ce8f0a1391d511370f6e07f (master) Fixed in f725de13188853feafa7abe0fdbca8a9451e1a48 (1.9) Fixed in 5f0b12ff7b5cfee07f4fc13f9ce147f569b3d33b (1.8)

comment:6 Changed 6 years ago by joyceyu

I have a similar problem when I try to optimize the css, I used version 1.9.1 and 1.9.3 but the problem is still there.. Does this fix also apply to the following error?

error(357) While optimizing a CSS file, it was impossible to compute the destination location of a relative URL. CSS file: C:/css/site.css; import: C:/css/theme.css; relative URL: url(../images/icons/icon.png)

  • site.css imports theme.css which has relative path to the image (and the image path is correct)
Note: See TracTickets for help on using tickets.