CSS and Resources

Oct 14, 2011 at 8:54 PM

Yes, I agree that it's totaly no good design and everyone should avoid it but there is at least one scenario where i realy need process css with minifier. Cause my specific design need to size window while using window.open() from js and to size it in css while opening same html by url)

Maybe i did smt wrong, but -res didn't work for me while using -css and did jsspecific minification using -js. I can workaround it if there there is a way to just replace resources strings and turn of any minification actions.


Oct 17, 2011 at 9:43 PM

Resource replacement works differently in CSS than it does in JS.

For CSS files, resource RESX files are name/value pairs that are used in declaration value-replacement. When a comment is encountered with the format /* [ID] */, where "ID" is a string identifier name, the RESX file is checked for a string named "ID". If it exists, the value of that resource string is then used as the value for the next declaration value.

Let's look at an example. Assume you have a RESX file that has a string named "FooMargins" with a value "0 0 2px 12px". If your CSS code looks like this:

div a span { display: block; /* [FooMargins] */ margin: 0; }

Then when the comment /* [FooMargins] */ is encountered, AjaxMin will look in the RESX file for a string named "FooMargins". It exists (due to the previous assumption), so the value, "0 0 2px 12px" is used as the next declaration value (the value for the "margin" property) and the resulting CSS would be:

div a span { display: block; margin: 0 0 2px 12px; }

Hope that helps.  




Oct 17, 2011 at 9:44 PM

I guess that's another documentation page I need to write for the website....

Oct 18, 2011 at 7:45 AM

Thank you, Ronlo! Realy nice to see it works, very useful functionality!!!!!!!!!!!