Opened 6 years ago

Closed 4 years ago

#17450 closed defect (invalid)

CSS: Impossible to compute the destination location of a relative URL

Reported by: xMartin Owned by:
Priority: undecided Milestone: 1.11
Component: BuildSystem Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

I put together a setup where I get the above error.

  • It doesn't matter if the image file exists.
  • It does not produce an error in Dojo 1.7.5 but it does in Dojo 1.8.5 and 1.9.1.
  • It seems to work although outputting the error. The build looks correct.
  • The error only occurs for the CSS file that imports one with a background image, not for the file that has the background image.

The message: error(357) While optimizing a CSS file, it was impossible to compute the destination location of a relative URL. CSS file: /Users/.../cssbuildtest/Project2/src/main/webapp/resources/css/dev/main.css; import: /Users/.../cssbuildtest/Project2/src/main/webapp/resources/css/dev/app.css; relative URL: url(../../img/sample.jpg)

Attachments (1)

cssbuildtest.zip (63.1 KB) - added by xMartin 6 years ago.
test setup

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by xMartin

Attachment: cssbuildtest.zip added

test setup

comment:1 Changed 6 years ago by jmorrin

I think you have an error in your build profile.

The image is relative to the css files in your project. When optimizing the CSS the build will adjust relative URLs to make sure they are correct when the assets are written to the destination directory.

In your build profile the image directory was not visible to the layer, so when it tried to resolve the relative URL it would fail.

If you adjust your build profile layer so that the images are visible the build succeeds.

Here is a modified build profile which builds successfully without any errors.

var profile = {

  action : 'release',
  cssOptimize : 'comments',
  layerOptimize : false,
  releaseName : 'build',
  basePath : ".",
  releaseDir : "Project1/src/main/release",

  packages : [ {
    name : "dojo",
    location : "../dojo" }, {
    name : "css",
    location : "Project2/src/main/webapp/resources"

  } ],

  layers : {
    "dojo/dojo" : {
      include : [ "dojo/dojo" ],
      customBase : true,
      boot : true }
  }

};

Your original build profile looked like:

var profile = {

	action : 'release',
	cssOptimize : 'comments',
	layerOptimize : false,
	releaseName : 'build',
	basePath : ".",
	releaseDir : "Project1/src/main/release",

	packages : [ {
		name : "dojo",
		location : "Project1/src/main/webapp/dtk/dojo" }, {
		name : "css",
		location : "Project2/src/main/webapp/resources/css/dev" 
        } ],

	layers : {
		"dojo/dojo" : {
			include : [ "dojo/dojo" ],
			customBase : true,
			boot : true }
	}

};

The images were located under Project2/src/main/webapp/resources/img and couldn't be located when optimizing the css.

comment:2 Changed 4 years ago by dylan

Milestone: tbd1.11
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.