 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
LineshJose.com: How To Create A Simple CSS Compressor Using PHP
by Chris Cornutt June 06, 2012 @ 08:44:26
In this recent post to his blog Linesh Jose shows you how to create a simple PHP-based compressor for your CSS (using some string replacement methods and a regex or two).
CSS or Cascading Style Sheets is a language used to describe the presentation of a document written in a markup language. If you're developing a very complex design for your site, CSS scripts become very long, and takes too much time to load. But a compressed CSS script can help your website load faster and easily maintain its functionality. Here, I've created a very simple CSS compressor using PHP to compress or reduce CSS script size.
You can read through the example code and see how it all works or you can download the code and see a live demo of it in action. His script does the compression on the fly, but it's not a far stretch to get it set up as a part of a build to output to a file on deployment.
voice your opinion now!
css compress tutorial strreplace pregreplace
DZone.com: Phar PHP libraries included with a single file
by Chris Cornutt September 23, 2011 @ 11:30:40
On DZone.com today Giorgio Sironi has a new post looking at an interesting, if seldom used, feature of recent PHP releases - packaging applications with phar archives.
Phar is a php extensions that provides the means for distributing code as a single archive, that does not have to be extracted to a folder before usage. The concept is similar to JVM Jars: each archive becomes a virtual directory where files can be accessed. However, the virtual folder is not limited to class loading, but you can open and read internal files as if it were decompresse into a directory.
He includes a brief "hello world" example of packaging up a script into a phar archive and executing it via PHP. He also shows how easy it is to create an archive from current code, making an archive containing the latest Doctrine 2 release for simple inclusion. Phars also allow compression and hashing but has issues with resource management and access external files.
voice your opinion now!
phar archive file compress doctrine2 tutorial
Sander Marechal's Blog: A YuiCompressorFilter for Phing
by Chris Cornutt August 02, 2011 @ 09:16:37
Sander Marechal has been working with Phing in some of his recent development and has created something useful for compressing Javascript and CSS files on the deployment of your application - a YuiCompressor task.
I am going to write several useful extensions, the first of which is a YuiCompressorFilter. Phing already has support for a JavaScrip minifier in the form of the JsMinTask, but the yui-compressor is more useful. Not only does it usually compress better than JsMin, it can also compress CSS files. Also, because my YuiCompressor extension is implemented as a filter instead of a task you can do fancy things like minifying and concatenating files in a single step.
He includes both a sample of the task and it's configuration (the XML) in the post as well as a link to its source over on github.
voice your opinion now!
javascript compress phing task css
Thomas Weidner's Blog: Compression and Decompression for ZF
by Chris Cornutt September 23, 2009 @ 10:26:40
As Thomas Weidner mentions in a new blog post, starting with the 1.10 release of the Zend Framework there'll be a new component to help with compressing and decompressing files - Zend_Filter_Compress/Decompress.
The new components Zend_Filter_Compress and Zend_Filter_Decompress provide a unified API for several compression formats. Actually the formats BZ2, GZ, LZF, RAR, TAR and ZIP are implemented: You can not only work with Strings, but also with Files and also with complete Directories.
He includes a quick example of how it will work with both data (like a string) and writing out the information to a compressed file. You can find out more about the component from Thomas' proposal on the Zend Framework wiki.
voice your opinion now!
zendframework compress decompress
Michael Caplan's Blog: Don't Forget to Flush
by Chris Cornutt January 08, 2009 @ 12:09:15
In this recent post to his blog Michael Caplan looks at a feature of PHP that's sometimes forgotten when pushing out larger chunks of data - flushing.
As a recluse who prefers hiding behind servers rather than dancing around your web browser's canvas, I was intrigued with their server side recommendations - however sparse they may be. In particular, flushing generated head content early to speed up overall page delivery and rending time was a technique new to me.
Michael looks at what "flushing generated head content" means and includes a scenario - pulling the top palettes from the COLOURlovers site - and some performance stats on page load time and response time directly from the server (complete with graphs).
voice your opinion now!
flush chunk compress head content load time statistics response
|
Community Events
Don't see your event here? Let us know!
|