开发者

When using YUI Compression viaChirpy to Mash Css files how can I get round relative URLs?

开发者 https://www.devze.com 2023-03-22 19:14 出处:网络
I am attempting to use Chirpy to mash all the CSS files from various sub directories into a single file.

I am attempting to use Chirpy to mash all the CSS files from various sub directories into a single file.

This works to the extent that I get a single minified file containing all of the CSS.

The problem I am having is that the CSS files that are referenced contain relative paths to images so when mashed the resulting file contains CSS with invalid image references.

For example:

<!-- Jquery -->
<File Path="ThirdParty\Jquery\jquery-ui-1.8.custom.css" />
<File Path="ThirdParty\Jquery\Plugins\colorbox\colorbox.css" />

<开发者_运维问答!-- Ext -->
<File Path="ThirdParty\Ext_3.2.1\ux\LockingGridView.css" />
<File Path="ThirdParty\Ext_3.2.1\plugins\Schedule_1.7\css\sch-all.css" />

Each of these files contains entries along the lines of:

.ui-widget-header { url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) }

When this entry gets "Mashed" into a central file in another location the url is no longer valid.

Does anyone know of a way around this other than updating all of the urls in every CSS file?

(I am wondering whether the YUI compression tool via chirpy can do this for me).

I would like to avoid absolute urls because the site code is re-used in sub directories on the same web server.


I suggest switching to Sass / SCSS combined with Scout App. That way, you can @include all helper sheets (like mixins or themes) in the main one, that is compiled and minified into a single css file.

All css files work seamlessly as scss, so no headache there.

My coding (and life) have so much improved after this upgrade.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号