Code: Select all
<?php
/* ... snip ... */
$newcss = preg_replace('/\s+/', ' ', $css);
/* ... snip ... */
?>Moderator: General Moderators
Code: Select all
<?php
/* ... snip ... */
$newcss = preg_replace('/\s+/', ' ', $css);
/* ... snip ... */
?>Yeah, that's why they're so great. If you change a CSS file and upload it, and continue browsing the site, you shouldn't see any changes. When you refresh the page, that's when the changes that you defined will occur.Jcart wrote:Are you using external css files? These are already cached by the browser, just so you know.
Code: Select all
/***** Base CSS Style ******/
/* Inspired by A List Apart*/
@import "common/screen.reset.css";
@import "common/screen.type.css";
@import "common/screen.form.css";
@import "common/screen.two-column-layout.css";
/**
* Put common colors here
* ------------------------
* Black : #000000
*
* Beige colors
* ------------------------
* BG Light : #F3E7BD
*
* Browns
* ------------------------
* Main brown : #392E24
*
*/
/*** Put customized styling below ***/Code: Select all
/***** Base CSS Style ******/
/* Inspired by A List Apart*/
@import "common/generated-compressed-framework.php"; /* gzipped css */
/**
* Put common colors here
* ------------------------
* Black : #000000
*
* Beige colors
* ------------------------
* BG Light : #F3E7BD
*
* Browns
* ------------------------
* Main brown : #392E24
*
*/
/*** Put customized styling below ***/I see.http://alistapart.com/articles/frameworksfordesigners wrote:On large, high-traffic sites, adding five more HTTP connections to every page view may result in angry system administrators. Two possible solutions to this are:
[...]
2. Have a server-side process that dynamically flattens the individual files into a single response. I’ve not seen this done, but it could be very efficient if done well.
Code: Select all
'/\*.**\*/'Code: Select all
'/\*(!\*/)*\*/'Code: Select all
/\*.*?\*/Code: Select all
$css =~ s,/\*(.*?)\*/,,gsi;Code: Select all
$css =~ s,/\*/\*//\*/,_put_token_value($&),sige; # Fabrice's InversionHmm... Wouldn't that be way more expensive than the HTTP requests?The Ninja Space Goat wrote:I'm having a difficult time with removing comments. My regex is catching anything from the first instance of /* to the very last instance of */ and I know why (because it's greedy), but how do I fix it?
The greedy one:My attempt at making it not greedy:Code: Select all
'/\*.**\*/'Suggestions? All the asterisks and slashes are making my head hurt.Code: Select all
'/\*(!\*/)*\*/'
I don't disagree with your conclusion and suggestion, but I want to respond to the concept that led you to it.Oren wrote: Hmm... Wouldn't that be way more expensive than the HTTP requests?
I suggest that you write your framework + a program that takes all the files you need for a site and combine them into 1 file. Then you take this file, save it, and use it on a specific site. Doing all this process/parsing over and over again is overkilling