We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

SL Combinator : Combine and Compress JavaScript and CSS on-the-fly : Version Update (2.1.0) 1st April, 2009

Development and Programming

birdie's avatar
birdie
68 posts
16 years ago
birdie's avatar birdie

Hi Stephen,

My turn to apologise! I just got back to this now and tried it out - seems to do the trick and it’s knocked another 15k off so happy days!

Thanks for your help…

Cormac

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis
My turn to apologise! I just got back to this now and tried it out - seems to do the trick and it’s knocked another 15k off so happy days!

Cool, glad the problem’s sorted.

Cheers, Stephen

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham
Not for me. Anyway, the solution is still to avoid the “_pi”. Rename the class accordingliy.
The problem comes when you actually use the plugin (as opposed to just viewing it in the CP); it throws an error on the page. As for renaming the class, that would cause a conflict in the code with the extension class. I may try renaming the extension class instead, so the plugin can function without the “_pi” suffix. Thanks for the suggestions. Stephen

I found out about this the hard way as well. Now I use _pl as the suffix, why? becuase EE parses out the “pi.” part of the filename to get the tag method.

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis
I found out about this the hard way as well. Now I use _pl as the suffix, why? becuase EE parses out the “pi.” part of the filename to get the tag method.

Thanks for the tip Leevi. I was wondering why you’d made that change.

Cheers, Stephen

       
notacouch's avatar
notacouch
92 posts
16 years ago
notacouch's avatar notacouch
Hi Dave, I’ve never encountered this problem, or been contacted by somebody who has. The plugin uses minify for all the heavy lifting, and I’m wondering if you problem relates to this minify bug. It might be worth removing the @charset declaration from the start of the CSS file(s), and seeing if that makes a difference. Hope that helps, Stephen P.S. If you can point me to the exact styles that are being mangled, I’ll see if I can work out the root cause.

Just wanted to report that a site we’re working on breaks in Safari 4 and a colleague tracked the problem down to SL Combinator. iirc had something to do with an odd issue with safari and a particular cache setting (max age?).

haven’t tried the above though.

also i noticed sl combinator makes a query for every time it’s used on a template is there a way to avoid that? e.g. sess cache?

thanks

i’ve used an earlier version on a previous project. was the first time i used dynamic compression, have been wanting to do that for a long time. thanks!

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis

Hi Abed,

Just wanted to report that a site we’re working on breaks in Safari 4 and a colleague tracked the problem down to SL Combinator. iirc had something to do with an odd issue with safari and a particular cache setting (max age?).

Ok, thanks for letting me know, I’ll see if I can reproduce the problem.

also i noticed sl combinator makes a query for every time it’s used on a template is there a way to avoid that? e.g. sess cache?

AFAIK, there’s no way around this. Plugins are instantiated on an as-needed basis, so if the SL Combinator tag is used 3 times, the plugin gets instantiated 3 times, and the database settings are retrieved 3 times.

Cheers, Stephen

       
Mikee Bee's avatar
Mikee Bee
179 posts
about 16 years ago
Mikee Bee's avatar Mikee Bee

I get the same HTTP error when I try and access the file in the browser using this method http://domain.com/utils/min/index.php?f=/css/screen.css

Did you figure out why this was happening?

Cheers

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
about 16 years ago
Stephen Lewis's avatar Stephen Lewis

Hi Mikee,

How many separate files are you attempting to combine and compress?

Stephen

       
Mikee Bee's avatar
Mikee Bee
179 posts
about 16 years ago
Mikee Bee's avatar Mikee Bee

Hi Stephen

8 .js files and 2 .css files

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis
8 .js files and 2 .css files

Quick question: are you attempting to combine JS files with CSS files?

Stephen

       
Mikee Bee's avatar
Mikee Bee
179 posts
15 years ago
Mikee Bee's avatar Mikee Bee

Erm, I don’t think so… here is the code…

<!-- CSS -->
{exp:sl_combinator:combine_css disable="no" debug="no"}
<link href="{site_url}styles/reset.css" rel="stylesheet" media="screen, projection" type="text/css">
<link href="{site_url}styles/wilmington_styles.css" rel="stylesheet" media="screen, projection" type="text/css">

<link href="{site_url}styles/fancybox.css" rel="stylesheet" media="screen, projection" type="text/css">
{/exp:sl_combinator:combine_css}
<link href="/styles/print.css" rel="stylesheet" media="print" type="text/css">

<!--[if lt IE 8]>
    <link href="/styles/iecss.css" rel="stylesheet" type="text/css" />
<![endif]-->

<!--[if IE 8]>
    <link href="/styles/ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->

<title>{embed:pagetitle} | Titles</title> 


<meta name="description" content="{embed:description}">
<meta name="keywords" content="{embed:keywords}">
<meta name="author" content="Netstep Corporate Communications Ltd">

{exp:sl_combinator:combine_js disable="no" debug="no"}
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
{/exp:sl_combinator:combine_js}
       
Adam George's avatar
Adam George
283 posts
15 years ago
Adam George's avatar Adam George

This is a great plugin!

I’m getting the same problem when combining css files though (HTTP/1.0 400 Bad Request).

Hopefully a solution can be found.

I had a problem with sl combinator and gzip, which I was able to solve, so I thought I would post here in case anyone else has the same issue:

I have this php gzip directive in my htaccess file:

php_value output_handler ob_gzhandler

However, with this on, and sl combinator combining my javascript files, the end result was mangled javascript.

The solution is to create another htaccess file in your utils/min directory and put this in it:

php_value output_handler none

Hope this helps

Would love it if the css bad request issue could be sorted too.

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis

Hi Adam,

Thanks for the tip regarding the PHP directive, I’ll make a note of that in case it affects others in the future.

As for the the “400 Bad Request” error, I’m unable to recreate it, which is making bug-fixing something of a problem.

I’ll have another stab at it next week, and let you (and Mikee Bee) know if I make any progress.

Cheers, Stephen

       
Adam George's avatar
Adam George
283 posts
15 years ago
Adam George's avatar Adam George

Thanks Stephen!

If it helps, this is my setup:

ExpressionEngine 1.6.7 Build: 20090320

{exp:sl_combinator:combine_css disable="no" debug="no"}
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=styles/reset.css}" />
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=styles/global.css}" />
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=styles/niftyCorners.css}" />
{/exp:sl_combinator:combine_css}

And the generated file:

<link rel="stylesheet" type="text/css" media="all" href="/utils/min/index.php?f=http://www.example.com/?css=styles/reset.css.v.1241805982,http://www.example.com/?css=styles/global.css.v.1246849285,http://www.example.com/?css=styles/niftyCorners.css.v.1241805965" />

And the error is:

HTTP/1.0 400 Bad Request

Full headers:

GET /utils/min/index.php?f=http://www.example.com/?css=styles/reset.css.v.1241805982,http://www.example.com/?css=styles/global.css.v.1246849285,http://www.example.com/?css=styles/niftyCorners.css.v.1241805965 HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Accept: text/css,*/*;q=0.1
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.example.com/
Cookie: exp_last_visit=1251075909; exp_last_activity=1251165151; exp_tracker=a:4:{i:0;s:5:"index";i:1;s:7:"/blogs/";i:2;s:6:"/news/";i:3;s:5:"index";}; exp_expiration=1251201151; exp_uniqueid=dfc01b5490e34b4afc225578bb1125e88968accb; exp_userhash=6cfcd1c9531f64a0625efb5e97d121932e7497cd; exp_anon=1; exp_perpage=50; exp_sessionid=a5114fdef2779733f331eda9e2cba02b2dd1e699
Pragma: no-cache
Cache-Control: no-cache
HTTP/1.x 400 Bad Request
Date: Wed, 26 Aug 2009 08:49:53 GMT
Server: Apache/1.3.41 (Unix) PHP/5.2.6 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a
X-Powered-By: PHP/5.2.6
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

NOTE: I have tried this with and without gzip with no luck. I have also tried this with and without using EE’s {stylesheet} declaration.

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis

Now that’s what I call a bug report. So good in fact, that it deserved a swifter response, so apologies for the delay in replying.

It looks to me like the problem is that a full URL is being passed to minify, rather than an absolute URL.

In other words, if you pass “/css/thingy.css” instead of “http://example.com/css/thingy.css”, it should work.

Let me know how you get on.

Stephen

       
First 3 4 5 6 7 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.