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.
Per the documentation at http://requirejs.org/docs/optimization.html#onecss:
This causes a problem when optimizing a single CSS file where the
outpath is not in the same directory as thecssInpath. I see a few options but haven't had a chance to think about the pros and cons of each properly:outoption. Intuitive to configure but might be difficult to calculate in practise and doesn't allow for a custom override.baseUrlto relativeurl()paths. Might cause problems when optimizing a whole project, as thebaseUrlwould be being used for 2 different things.cssPrefix(orcssBaseUrletc.) to relativeurl()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.