Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

CSS optimizer makes url() relative to cssIn option #350

Closed
cmbuckley opened this Issue Jan 15, 2013 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

cmbuckley commented Jan 15, 2013

Per the documentation at http://requirejs.org/docs/optimization.html#onecss:

The url() path fixing will always fix the paths relative to the cssIn build option path, not the out build option.

This causes a problem when optimizing a single CSS file where the out path is not in the same directory as the cssIn path. I see a few options but haven't had a chance to think about the pros and cons of each properly:

  • Determine the correct path by using the out option. Intuitive to configure but might be difficult to calculate in practise and doesn't allow for a custom override.
  • Prepend baseUrl to relative url() paths. Might cause problems when optimizing a whole project, as the baseUrl would be being used for 2 different things.
  • Prepend a new option cssPrefix (or cssBaseUrl etc.) to relative url() paths. This seems the simplest choice but adds another config parameter.

At first glance, the third option seems best, but it might be desirable to try the first option if no config option is passed.

Owner

jrburke commented Jan 16, 2013

The cssPrefix seems like the best out of those options. I'm open to that, but putting this in the 2.1.4 bucket, trying to lock down the 2.1.3 work this week.

Contributor

cmbuckley commented Jan 16, 2013

OK, great! I implemented that and removed the cssRelativeUrl stuff, as I might have a play around with that in a separate branch / PR. It would likely break BC anyway.

@jrburke jrburke closed this in e2bb479 Jan 21, 2013

jrburke added a commit that referenced this issue Jan 21, 2013

@jrburke jrburke referenced this issue Mar 27, 2013

Open

css base url #412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment