Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Minify (JS & CSS) plugin for cpg1.5x  (Read 14273 times)

0 Members and 2 Guests are viewing this topic.

jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Minify (JS & CSS) plugin for cpg1.5x
« on: May 31, 2011, 08:52:35 pm »

Hi everyone!

For some time I used the JSmin plugin by Timos-Welt (http://forum.coppermine-gallery.net/index.php/topic,63223.0.html) but actually had to rewrite it to get it working like I wanted it to be.

Still, I needed the CSS minified, too. When I stumbled apon Minify I decided to write this plugin. It does exactly what I need, is well maintained and fast.

Description
This plugin is an integration of Minify for the Coppermine Gallery. The main goal is to save HTTP requests, bandwith and speed up page loading time by detecting CSS and Javascript files used throughout the gallery - clean, combine, compress and serve them highly optimized.

Installation
Install through plugin manager. Surf through different pages of your gallery and check the plugins configuration to enable found CSS and JavaScript files for optimization.

Known issues
When I included the js/thumbnails.js file to be minified, the filmstrip did not work as expected anymore.

This is the initial release. Please test and report any bugs you find.

Plugin in action at Home Theater Backdrops.

Cheers,
Jayhunter
« Last Edit: May 31, 2011, 09:18:44 pm by jayhunter »
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Minify (JS & CSS) plugin for cpg1.5x
« Reply #1 on: June 01, 2011, 11:13:33 am »

Known issues
When I included the js/thumbnails.js file to be minified, the filmstrip did not work as expected anymore.
I haven't looked at that file nor tested your plugin yet, but do you have any suggestion how we can make it work? Maybe there's just a missing semi-colon or something similar.
Logged

jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: Minify (JS & CSS) plugin for cpg1.5x
« Reply #2 on: June 01, 2011, 05:48:47 pm »

I haven't looked at that file nor tested your plugin yet, but do you have any suggestion how we can make it work? Maybe there's just a missing semi-colon or something similar.

I have no clue why it does not work and I didn't go into the code either. This is the only file that caused trouble while testing. Even all those swf upload and several .js files from different plugins do work beautiful when included. My wildest guess is that there is a conflict between thumbnails.js and displayimage.js (obvious I guess ...) when they are loaded simultaniously, maybe the inclusion order? No idea so far ...
Logged

papukaija

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 333
Re: Minify (JS & CSS) plugin for cpg1.5x
« Reply #3 on: July 03, 2011, 05:27:58 pm »

I have some suggestions for your great plugin. I noticed from your demo page's source that this plugin loads Javascript first and then CSS. However, both Google and Yahoo! recommend to include CSS first and then Javascript.

This would mean that line 72 (for CSS) in codebase.php should be changed to:
Code: [Select]
$html = str_replace('<head>','<head><link rel="stylesheet" href="' . $min_file . '" type="text/css" />',$html);
and line 88 (for JS) to:
Code: [Select]
$html = str_replace('</head>', '<script type="text/javascript" src="' . $min_file . '"></script></head>',$html);
You should also remove the massive empty lines from that file, the first set starts from line 94 and the second from line 153.
Logged

jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: Minify (JS & CSS) plugin for cpg1.5x
« Reply #4 on: July 03, 2011, 07:10:01 pm »

Thanks for the suggestion papukaija.

I included the changes in my developement copy and they will be in the next release. I plan to further enrich the plugin with grouping (e.g. swfupload files separte) and sorting options (e.g. jQuery first). This might take some time though ...

Cheers,
Tobias
Logged

pols1337

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 244
Re: Minify (JS & CSS) plugin for cpg1.5x
« Reply #5 on: February 04, 2012, 09:12:34 am »

/bump

I hope you're still considering releasing an updated Minify plug-in. 
Logged

netb

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 82
Re: Minify (JS & CSS) plugin for cpg1.5x
« Reply #6 on: September 27, 2015, 03:36:23 am »

/bump
Any news on newer version, also have you considered loading the JS's with async or defer? :)
Logged

marcelm

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: Minify (JS & CSS) plugin for cpg1.5x
« Reply #7 on: September 29, 2015, 05:37:09 pm »

Type writer of the plug-in has not logged in since two years so not much chance of a new version.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.