Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
43 posts Page 2 of 5
Thanks, that is very usefull, I'll keep it in mind!
Thanks a lot for this add-on Tim, this is really very useful
Hey Tim, this looks great, thanks!

However, I am having problems getting it to work. I am trying to implement it on a couple of sites, and I am getting the following errors (this is from a site on my local server - I've tried it online too):
Code: Select all
 Warning: filemtime(): stat failed for C:/xampp1/htdocs/mysite/<link in C:\xampp1\htdocs\mysite\couch\addons\minify-js-css\minify.php on line 38

The page is basically a list of errors like this - I am assuming there is something wrong with the filepaths. I am using the Couch 2.1 beta - is there maybe something in the new version that is stopping this working? I've tried it with Prettyurls both on and off, so that isn't the problem.
I have uploaded the minify folder into addons, and added the appropriate line to kfunctions.
The code I am using is:
Code: Select all
<cms:minify 'css' into='css/style.min.css'>
<link rel="stylesheet" href="css/hamburgers.css">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">

I can't quite see what the problem is, but I'm probably missing something pretty obvious!
Thanks in advance.
You're correct, @ewanmc. The problem is with the file paths. The tag only wants to see the file names relative to the root. You don't need the <link> tags. So like this:
Code: Select all
<cms:minify 'css' into='css/style.min.css'>
D'oh! I knew I was being stupid and missing something obvious. Sometimes it just needs someone to look at it and instantly see what is wrong. :oops:

Thanks so much, great work!
Hi Tim,
Your plugin really saves a lot of routine work :)

I want to ask you for a small change in the way the data is output.
Now they look like this:
<link href="my-site/my-css-file.css?timestamp" rel="stylesheet" >

Can you change the data output as follows (Internal Style Sheet):
here is the whole CSS min code - for example
.broene:nth-child(4n) {margin-right:0;} ... ... ... border:0;height: 1px; ... ... ...

It should also be dropped whole timestamp.

Why is this necessary?
This is a better way to embed CSS code into small and almost-large sites for Google speed.
I have a few sites that I use internal Style Sheet and I see better results!

I believe this will be useful to many Couch users :)
Thanks @orbital. I'm glad you like it.

The tag will embed css or scripts on the page if you don't name an output file.
Code: Select all
    <cms:minify 'css'>

    <cms:minify 'js'>
That really works - thank you :)

Tim can anything be done to HTML compress? (HTML Minifier) I know this is complicated but would be very good ...
Removing whitespace is not too complicated, @orbital, but it hardly seems worth it to me. The tabs and character returns we use to make HTML more readable just don't add up to enough bytes to bother with.

@trendoman might have created something to minify HTML. I know he's messed around with a lot of different code for minification and optimization.

I think that enabling Gzip compression on the server would be the best way to optimize your HTML files. I use this method:

Hi Tim,
I'm already using your script and it's all right ;) Thanks!

An interesting situation -
<cms:minify 'css' >

<cms:if this_is_main_index_page >

I think the idea is clear, but unfortunately this does not work - can something be done or is it impossible?
43 posts Page 2 of 5