Posted: March 02, 2012 17:38 by ingeo
In the project I am currently developing I have come across an issue where relative image paths declared in generated CSS are not displayed when running the application with Jawr DEBUG mode enabled.
I have two bundles, the first is generated using the Less CSS generated found at https://github.com/eliotsykes/less-css-jawr and the second is a traditional CSS file.
<!-- LESS BUNDLE --> <link rel="stylesheet" type="text/css" media="all" href="/mycontext/cssb/jawr_generator.css?generationConfigParam=less%3A%2Fresources%2Fbootstrap%2Fless%2Fbootstrap.less" /> <!-- CSS Bundle --> <link rel="stylesheet" type="text/css" media="all" href="/mycontent/cssb/resources/theme/mytheme/css/backgrounds.css" />
The bundle paths start with /mycontext/cssb/ however the CSS bundle includes additional path information (resources/themes/mytheme/css/...) which the generated bundle does not include.
The end result is relative images declared within the generated content fail to load because their path is incorrect.
Both files use background: url(../img/myfile.png); however the path requested from the server for the image from the traditional CSS bundle is:
http://localhost:8080/mycontext/cssb/resources/theme/mytheme/img/icons/ico-search.png and the Generated bundle's path is http://localhost:8080/mycontext/cssb/img/icons/ico-search.png
Is there a way to force jawr to include the additional path information when it generates the bundles URL. The generated bundle's url does contain the path in the query string generationConfigParam=lessresources/bootstrap/less/bootstrap.less
I should also note that if I run JAWR in production mode the css path rewriter rewrites the image paths in both the LESS and CSS bundle and the images display correctly.