1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-06 22:26:28 +02:00
This commit is contained in:
Steve Clay
2008-02-28 21:14:06 +00:00
parent 0a939d4f91
commit 041ea14cc4
39 changed files with 46 additions and 4578 deletions

41
README
View File

@@ -1,5 +1,40 @@
Note: Current trunk is progress on V2 and should be considered "alpha".
Note: This is early work on version 2 of Minify and should be considered "alpha". You may wish to choose an earlier release from http://code.google.com/p/minify/downloads/list . The documentation at http://code.google.com/p/minify/ applies to those releases.
Documentation at http://code.google.com/p/minify/ needs updating.
SETUP
For example usage, see files in /examples/1/
Minify is a library of files inside the "lib" directory. Wherever you place "lib", it needs to be in your include_path, and should be access-protected or outside of DOCUMENT_ROOT.
TESTING
1. Place the "web" directory somewhere in DOCUMENT_ROOT.
2. Edit "config.php" to manually add "lib" to the include_path.
3. To enable server-side caching, set $minifyCachePath to a PHP-writeable directory
4. visit http://yourdomain.com/path/to/web/example/1/
5. call each "test_*.php" file in http://yourdomain.com/path/to/web/test/
MINIFY OVERVIEW
Minify is an HTTP content server. It combines sources of content (usually files), compresses the result and serves it with appropriate HTTP headers. These headers can usually allow clients to perform conditional GETs (serving content only when clients do not have a valid cache) or tell clients to cache the file until a given date/time.
Minify works with Minify_Source objects. These usually represent a file on disk, but a source can also be content on hand or from a database. Sources with known "last modified" timestamps allow Minify to implement conditional GETs.
You configure Minify via a Minify_Controller object. The controller supplies the sources and some other information about a request, determining how it's to be responded to. Several controllers are supplied with Minify, but it's also fairly easy to write your own. E.g. a controller could emulate v1.x of minify.php.
To use an existing controller, you call Minify::serve(), passing it the name of your controller of choice (without the "Minify_Controller" prefix), an array of options for the controller, and an array of general Minify options (optional). Eg.:
// serve a minified javascript file and tell clients to cache it for a year
Minify::serve(
'Files'
,array('/path/to/file1.js', '/path/to/file2.js')
,array('cacheUntil' => (time() + 86400 * 365))
);
The above creates an instance of Minify_Controller_Files, passing the two arrays to its constructor.
The first array depends on the controller. In this case, Minify_Controller_Files needs a list of file paths.
The second array (optional) has options for Minify. (Since this is passed through the controller, some controllers may use/alter this data).
MINIFY USAGE
Example 1 shows an example of using Minify to serve both the HTML and external CSS and JS files.

View File

@@ -1,66 +0,0 @@
<?php
require '../config.php';
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Minify Example 1</title>
<link rel="stylesheet" type="text/css" href="m.php?f=test.css&amp;v=3" />
<style type="text/css">
#cssFail {
width:2.8em;
overflow:hidden;
}
</style>
</head>
<body>
<?php if (! $minifyCachePath): ?>
<p><strong>Note:</strong> You should <em>always</em> enable caching using
<code>Minify::useServerCache()</code>. For the examples this can be set in
<code>config.php</code>. Notice that minifying jquery.js takes several seconds!.</p>
<?php endif; ?>
<h1>Minify Example 1</h1>
<p>This is an example of Minify serving a directory of single css/js files.
Each file is minified and sent with HTTP encoding (browser-permitting). </p>
<ul>
<li id="cssFail"><span>FAIL</span>PASS</li>
<li id="jsFail1">FAIL</li>
<li id="jsFail2">FAIL</li>
</ul>
<p><a href="">Link to this page (F5 can trigger no-cache headers)</a></p>
<script type="text/javascript" src="m.php?f=jquery-1.2.3.js&amp;v=1"></script>
<script type="text/javascript" src="m.php?f=test+space.js"></script>
<script type="text/javascript">
$(function () {
if ( 1 < 2 ) {
$('#jsFail2').html('PASS');
}
});
</script>
</body>
</html>
<?php
$content = ob_get_clean();
require 'Minify.php';
if ($minifyCachePath) {
Minify::useServerCache($minifyCachePath);
}
Minify::serve('Page', array(
'content' => $content
,'id' => __FILE__
,'lastModifiedTime' => filemtime(__FILE__)
// also minify the CSS/JS inside the HTML
,'minifyAll' => true
));

File diff suppressed because it is too large Load Diff

View File

@@ -1,50 +0,0 @@
<?php
/**
* This script will serve a single js/css file in this directory. Here we place
* the front-end-controller logic in user code, then use the "Files" controller
* to minify the file. Alternately, we could have created a custom controller
* with the same logic and passed it to Minify::handleRequest().
*/
require '../config.php';
/**
* The Files controller only "knows" HTML, CSS, and JS files. Other files
* would only be trim()ed and sent as plain/text.
*/
$serveExtensions = array('css', 'js');
// set HTTP Expires header if GET 'v' is sent
$cacheUntil = isset($_GET['v'])
? (time() + 86400 * 30)
: null;
// serve
if (isset($_GET['f'])) {
$filename = basename($_GET['f']); // remove any naughty bits
$filenamePattern = '/[^\'"\\/\\\\]+\\.(?:'
.implode('|', $serveExtensions). ')$/';
if (preg_match($filenamePattern, $filename)
&& file_exists(dirname(__FILE__) . '/' . $filename)) {
require 'Minify.php';
if ($minifyCachePath) {
Minify::useServerCache($minifyCachePath);
}
// The Files controller serves an array of files, but here we just
// need one.
Minify::serve('Files', array(
dirname(__FILE__) . '/' . $filename
), array(
'cacheUntil' => $cacheUntil
));
exit();
}
}
header("HTTP/1.0 404 Not Found");
echo "HTTP/1.0 404 Not Found";

View File

@@ -1,5 +0,0 @@
$(function () {
$('#jsFail1').html('PASS');
});

View File

@@ -1,19 +0,0 @@
/* Test file to minify */
/* Minify copyright notice here... */
h1 {
color: #00cc00;
font-size: 20px;
}
ul, li {
padding:0;
margin:0;
display:block;
font-family: monospace;
}
#cssFail span {
display: none;
}

View File

@@ -1,27 +0,0 @@
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
header('Content-Type: text/plain');
$thisDir = dirname(__FILE__);
/**
* pTest - PHP Unit Tester
* @param mixed $test Condition to test, evaluated as boolean
* @param string $message Descriptive message to output upon test
* @url http://www.sitepoint.com/blogs/2007/08/13/ptest-php-unit-tester-in-9-lines-of-code/
*/
function assertTrue($test, $message)
{
static $count;
if (!isset($count)) $count = array('pass'=>0, 'fail'=>0, 'total'=>0);
$mode = $test ? 'pass' : 'fail';
printf("%s: %s (%d of %d tests run so far have %sed)\n",
strtoupper($mode), $message, ++$count[$mode], ++$count['total'], $mode);
return (bool)$test;
}
?>

View File

@@ -1,3 +0,0 @@
/*/*/ a{}
.foo {color:red}
/* blah */

View File

@@ -1 +0,0 @@
/*/*/a{}.foo{color:red}/**/

View File

@@ -1,6 +0,0 @@
/* block comments get removed */
/* comments containing the word "copyright" are left in, though */
/* but all other comments are removed */

View File

@@ -1 +0,0 @@
/* comments containing the word "copyright" are left in, though */

View File

@@ -1 +0,0 @@
/* comments containing the word "copyright" are left in, though */

View File

@@ -1,31 +0,0 @@
/* hide from ie5/mac \*/ a{}
.foo {color:red}
/* necessary comment */
/* comment */
/* feed to ie5/mac \*//*/
@import "ie5mac.css";
/* necessary comment */
/* comment */
/*/ hide from nav4 */
.foo {display:block;}
/* necessary comment */
/* comment */
/*/ feed to nav *//*/
.foo {display:crazy;}
/* necessary comment */
/* comment */
div {
width: 140px;
width/* */:/**/100px;
width: /**/100px;
}
html>/**/body {}

View File

@@ -1 +0,0 @@
/*\*/a{}.foo{color:red}/**//*\*//*/@import "ie5mac.css";/**//*/*/.foo{display:block}/**//*/*//*/.foo{display:crazy}/**/div{width:140px;width/**/:/**/100px;width:/**/100px}html>/**/body{}

View File

@@ -1 +0,0 @@
/*\*/a{}.foo{color:red}/**//*\*//*/@import "ie5mac.css";/**//*/*/.foo{display:block}/**//*/*//*/.foo{display:crazy}/**/div{width:140px;width/**/:/**/100px;width:/**/100px}html>/**/body{}

View File

@@ -1,9 +0,0 @@
@import "foo.css";
@import 'bar/foo.css';
@import '/css/foo.css';
@import 'http://foo.com/css/foo.css';
@import url(./foo.css);
@import url("/css/foo.css");
@import url(/css2/foo.css);
foo {background:url('bar/foo.png')}
foo {background:url('http://foo.com/css/foo.css');}

View File

@@ -1 +0,0 @@
@import "../foo.css";@import '../bar/foo.css';@import '/css/foo.css';@import 'http://foo.com/css/foo.css';@import url(.././foo.css);@import url("/css/foo.css");@import url(/css2/foo.css);foo{background:url('../bar/foo.png')}foo{background:url('http://foo.com/css/foo.css')}

View File

@@ -1 +0,0 @@
@import "../foo.css";@import '../bar/foo.css';@import '/css/foo.css';@import 'http://foo.com/css/foo.css';@import url(.././foo.css);@import url("/css/foo.css");@import url(/css2/foo.css);foo{background:url('../bar/foo.png')}foo{background:url('http://foo.com/css/foo.css')}

View File

@@ -1 +0,0 @@
Test suite from http://search.cpan.org/~gtermars/CSS-Minifier-XS/

View File

@@ -1,21 +0,0 @@
/* some CSS to try to exercise things in general */
@import url( more.css );
body, td, th {
font-family: Verdana, "Bitstream Vera Sans", sans-serif;
font-size : 12px;
}
.nav {
margin-left: 20%;
}
#main-nav {
background-color: red;
border: 1px solid #00ff77;
}
div#content h1 + p {
padding-top: 0;
margin-top: 0;
}

View File

@@ -1 +0,0 @@
@import url(more.css);body,td,th{font-family:Verdana, "Bitstream Vera Sans",sans-serif;font-size:12px}.nav{margin-left:20%}#main-nav{background-color:red;border:1px solid #0f7}div#content h1+p{padding-top:0;margin-top:0}

View File

@@ -1 +0,0 @@
@import url(more.css);body,td,th{font-family:Verdana, "Bitstream Vera Sans",sans-serif;font-size:12px}.nav{margin-left:20%}#main-nav{background-color:red;border:1px solid #0f7}div#content h1+p{padding-top:0;margin-top:0}

View File

@@ -1,434 +0,0 @@
/* Based on the original Style Sheet for the fisubsilver v2 Theme for phpBB version 2+
Edited by Daz - http://www.forumimages.com - last updated 26-06-03 */
/* The content of the posts (body of text) */
/* General page style */
/* begin suggest post */
.float-l{
float: left;
}
.form-suggest{
height:200px;
background:#DEE2D0;
vertical-align: top;
}
.form-input input{
font-size: 10px;
}
.hide{
display:none;
}
.form-input textarea{
font-size: 11px;
width: 350px;
}
.form-label{
font-size: 10px;
font-weight: bold;
line-height: 25px;
padding-right: 10px;
text-align: right;
width: 100px;
color: #39738F;
}
.font-9{
font-size: 9px;
}
.form-topic{
font-weight:bold;
}
.form-error{
color:red;
}
.inline{
display: inline;
}
.space-10{
clear: both;
font-size: 10px;
height: 10px;
line-height: 10px;
}
.suggest-success{
color:green;
padding-left:10px;
font-size:11px;
font-weight:bold;
}
.top{
vertical-align: top;
}
/* end suggest post */
table td{
padding:3px;
}
a:link,a:active,a:visited,a.postlink{
color: #006699;
text-decoration: none;
}
a:hover{
color: #DD6900;
}
a.admin:hover,a.mod:hover{
color: #DD6900;
}
a.but,a.but:hover,a.but:visited{
color: #000000;
text-decoration: none;
}
a.topictitle:visited{
color: #5493B4;
}
a.topictitle:hover{
color: #DD6900;
}
body{
color: #000000;
font: 11px Verdana,Arial,Helvetica,sans-serif;
margin: 0 10px 10px 10px;
padding: 0;
overflow:auto;
}
/* General font families for common tags */
font,th,td,p{
font: 12px Verdana,Arial,Helvetica,sans-serif;
}
/* Form elements */
form{
display: inline;
}
hr{
border: 0px solid #FFFFFF;
border-top-width: 1px;
height: 0px;
}
/* Gets rid of the need for border="0" on hyperlinked images */
img{
border: 0 solid;
}
input{
font: 11px Verdana,Arial,Helvetica,sans-serif;
}
input.button,input.liteoption,.fakebut{
background: #FAFAFA;
border: 1px solid #000000;
font-size: 11px;
}
input.catbutton{
background: #FAFAFA;
border: 1px solid #000000;
font-size: 10px;
}
input.mainoption{
background: #FAFAFA;
border: 1px solid #000000;
font-size: 11px;
font-weight: bold;
}
input.post,textarea.post{
background: #FFFFFF;
border: 1px solid #000000;
font: 11px Verdana,Arial,Helvetica,sans-serif;
padding-bottom: 2px;
padding-left: 2px;
}
select{
background: #FFFFFF;
font: 11px Verdana,Arial,Helvetica,sans-serif;
}
table{
text-align: left;
}
td{
vertical-align: middle;
}
/* Category gradients*/
td.cat{
background-color: #C2C6BA;
font-weight: bold;
height: 20px;
letter-spacing: 1px;
text-indent: 4px;
}
td.genmed,.genmed{
font-size: 11px;
}
/* This is for the table cell above the Topics,Post & Last posts on the index.php */
td.rowpic{
background: #C2C6BA;
}
td.spacerow{
background: #E5E6E2;
}
/* Table Header cells */
th{
background-color: #FADD31;
background-image: url(images/cellpic3.gif);
background-repeat: repeat-x;
color: #68685E;
font-size: 11px;
font-weight: bold;
line-height:16px;
height: 16px;
padding-left: 8px;
padding-right: 8px;
text-align: center;
white-space: nowrap;
}
/* Admin & Moderator Colours MODification */
.admin,.mod{
font-size: 11px;
font-weight: bold;
}
.admin,a.admin,a.admin:visited{
color: #FFA34F;
}
/* This is the border line & background colour round the entire page */
.bodyline{
background: #FFFFFF;
border: 1px solid #98AAB1;
}
.center{
text-align: center;
}
/* Code blocks */
.code{
background: #FAFAFA;
border: 1px solid #D1D7DC;
color: #006600;
font: 12px Courier,"Courier New",sans-serif;
padding: 5px;
}
/* This is for the error messages that pop up */
.errorline{
background: #E5E6E2;
border: 1px solid #8F8B8B;
color:#D92A2A;
}
.explaintitle{
color: #5C81B1;
font-size: 11px;
font-weight: bold;
}
/* This is the outline round the main forum tables */
.forumline{
background: #FFFFFF;
}
/* General text */
.gensmall{
font-size: 10px;
}
.h1-font{
color: #006699;
display: inline;
font: bold 13px Verdana, Arial, Helvetica, sans-serif;
margin: 0;
text-decoration: none;
}
.h2-font{
display: inline;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.height1{
height: 1px;
}
.height22{
height: 22px;
}
.height25{
height: 25px;
}
.height28{
height: 28px;
}
.height30{
height: 30px;
}
.height40{
height: 40px;
}
/* This is the line in the posting page which shows the rollover
help line. Colour value in row2 */
.helpline{
border: 0 solid;
font-size: 10px;
}
.imgfolder{
margin: 1px 4px 1px 4px;
}
.imgspace{
margin-left: 1px;
margin-right: 2px;
}
/* Specify the space around images */
.imgtopic,.imgicon{
margin-left: 3px;
}
.left{
text-align: left;
}
/* The largest text used in the index page title and toptic title etc. */
.maintitle,h1,h2{
color: #5C81B1;
font: bold 20px/120% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
text-decoration: none;
}
.maxwidth{
width: 100%;
}
.mod,a.mod,a.mod:visited{
color: #006600;
}
/* Name of poster in viewmsg.php and viewtopic.php and other places */
.name{
font-size: 11px;
font-weight: bold;
}
/* Used for the navigation text,(Page 1,2,3 etc) and the navigation bar when in a forum */
.nav{
font-size: 11px;
font-weight: bold;
}
.nowrap{
white-space: nowrap;
}
.postbody{
font-size: 12px;
line-height: 125%;
}
.postbody a{
text-decoration: underline;
}
/* Location,number of posts,post date etc */
.postdetails{
color: #00396A;
font-size: 10px;
}
/* Quote blocks */
.quote{
background: #F3F3EF;
border: 1px solid #C2C6BA;
color: #006699;
font-size: 11px;
line-height: 125%;
}
.right{
text-align: right;
}
/* Main table cell colours and backgrounds */
.row1{
background: #F0F0EB;
}
.row2,.helpline{
background: #E5E6E2;
}
.row3{
background: #DBDBD4;
}
.subtitle,h2{
font: bold 18px/180% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
text-decoration: none;
}
/* titles for the topics:could specify viewed link colour too */
.topictitle {
color: #000000;
font-size: 11px;
font-weight: bold;
}
.underline{
text-decoration: underline;
}
.top{
vertical-align:top;
}
.image-hspace{
margin-right:3px;
}
.clear{
clear:both;
}

View File

@@ -1 +0,0 @@
.float-l{float:left}.form-suggest{height:200px;background:#DEE2D0;vertical-align:top}.form-input input{font-size:10px}.hide{display:none}.form-input textarea{font-size:11px;width:350px}.form-label{font-size:10px;font-weight:bold;line-height:25px;padding-right:10px;text-align:right;width:100px;color: #39738F}.font-9{font-size:9px}.form-topic{font-weight:bold}.form-error{color:red}.inline{display:inline}.space-10{clear:both;font-size:10px;height:10px;line-height:10px}.suggest-success{color:green;padding-left:10px;font-size:11px;font-weight:bold}.top{vertical-align:top}table td{padding:3px}a:link,a:active,a:visited,a.postlink{color: #069;text-decoration:none}a:hover{color: #DD6900}a.admin:hover,a.mod:hover{color: #DD6900}a.but,a.but:hover,a.but:visited{color: #000;text-decoration:none}a.topictitle:visited{color: #5493B4}a.topictitle:hover{color: #DD6900}body{color: #000;font:11px Verdana,Arial,Helvetica,sans-serif;margin:0 10px 10px 10px;padding:0;overflow:auto}font,th,td,p{font:12px Verdana,Arial,Helvetica,sans-serif}form{display:inline}hr{border:0px solid #FFF;border-top-width:1px;height:0px}img{border:0 solid}input{font:11px Verdana,Arial,Helvetica,sans-serif}input.button,input.liteoption,.fakebut{background: #FAFAFA;border:1px solid #000;font-size:11px}input.catbutton{background: #FAFAFA;border:1px solid #000;font-size:10px}input.mainoption{background: #FAFAFA;border:1px solid #000;font-size:11px;font-weight:bold}input.post,textarea.post{background: #FFF;border:1px solid #000;font:11px Verdana,Arial,Helvetica,sans-serif;padding-bottom:2px;padding-left:2px}select{background: #FFF;font:11px Verdana,Arial,Helvetica,sans-serif}table{text-align:left}td{vertical-align:middle}td.cat{background-color: #C2C6BA;font-weight:bold;height:20px;letter-spacing:1px;text-indent:4px}td.genmed,.genmed{font-size:11px}td.rowpic{background: #C2C6BA}td.spacerow{background: #E5E6E2}th{background-color: #FADD31;background-image:url(images/cellpic3.gif);background-repeat:repeat-x;color: #68685E;font-size:11px;font-weight:bold;line-height:16px;height:16px;padding-left:8px;padding-right:8px;text-align:center;white-space:nowrap}.admin,.mod{font-size:11px;font-weight:bold}.admin,a.admin,a.admin:visited{color: #FFA34F}.bodyline{background: #FFF;border:1px solid #98AAB1}.center{text-align:center}.code{background: #FAFAFA;border:1px solid #D1D7DC;color: #060;font:12px Courier,"Courier New",sans-serif;padding:5px}.errorline{background: #E5E6E2;border:1px solid #8F8B8B;color:#D92A2A}.explaintitle{color: #5C81B1;font-size:11px;font-weight:bold}.forumline{background: #FFF}.gensmall{font-size:10px}.h1-font{color: #069;display:inline;font:bold 13px Verdana,Arial,Helvetica,sans-serif;margin:0;text-decoration:none}.h2-font{display:inline;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.height1{height:1px}.height22{height:22px}.height25{height:25px}.height28{height:28px}.height30{height:30px}.height40{height:40px}.helpline{border:0 solid;font-size:10px}.imgfolder{margin:1px 4px 1px 4px}.imgspace{margin-left:1px;margin-right:2px}.imgtopic,.imgicon{margin-left:3px}.left{text-align:left}.maintitle,h1,h2{color: #5C81B1;font:bold 20px/120% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.maxwidth{width:100%}.mod,a.mod,a.mod:visited{color: #060}.name{font-size:11px;font-weight:bold}.nav{font-size:11px;font-weight:bold}.nowrap{white-space:nowrap}.postbody{font-size:12px;line-height:125%}.postbody a{text-decoration:underline}.postdetails{color: #00396A;font-size:10px}.quote{background: #F3F3EF;border:1px solid #C2C6BA;color: #069;font-size:11px;line-height:125%}.right{text-align:right}.row1{background: #F0F0EB}.row2,.helpline{background: #E5E6E2}.row3{background: #DBDBD4}.subtitle,h2{font:bold 18px/180% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.topictitle{color: #000;font-size:11px;font-weight:bold}.underline{text-decoration:underline}.top{vertical-align:top}.image-hspace{margin-right:3px}.clear{clear:both}

View File

@@ -1 +0,0 @@
.float-l{float:left}.form-suggest{height:200px;background:#DEE2D0;vertical-align:top}.form-input input{font-size:10px}.hide{display:none}.form-input textarea{font-size:11px;width:350px}.form-label{font-size:10px;font-weight:bold;line-height:25px;padding-right:10px;text-align:right;width:100px;color: #39738F}.font-9{font-size:9px}.form-topic{font-weight:bold}.form-error{color:red}.inline{display:inline}.space-10{clear:both;font-size:10px;height:10px;line-height:10px}.suggest-success{color:green;padding-left:10px;font-size:11px;font-weight:bold}.top{vertical-align:top}table td{padding:3px}a:link,a:active,a:visited,a.postlink{color: #069;text-decoration:none}a:hover{color: #DD6900}a.admin:hover,a.mod:hover{color: #DD6900}a.but,a.but:hover,a.but:visited{color: #000;text-decoration:none}a.topictitle:visited{color: #5493B4}a.topictitle:hover{color: #DD6900}body{color: #000;font:11px Verdana,Arial,Helvetica,sans-serif;margin:0 10px 10px 10px;padding:0;overflow:auto}font,th,td,p{font:12px Verdana,Arial,Helvetica,sans-serif}form{display:inline}hr{border:0px solid #FFF;border-top-width:1px;height:0px}img{border:0 solid}input{font:11px Verdana,Arial,Helvetica,sans-serif}input.button,input.liteoption,.fakebut{background: #FAFAFA;border:1px solid #000;font-size:11px}input.catbutton{background: #FAFAFA;border:1px solid #000;font-size:10px}input.mainoption{background: #FAFAFA;border:1px solid #000;font-size:11px;font-weight:bold}input.post,textarea.post{background: #FFF;border:1px solid #000;font:11px Verdana,Arial,Helvetica,sans-serif;padding-bottom:2px;padding-left:2px}select{background: #FFF;font:11px Verdana,Arial,Helvetica,sans-serif}table{text-align:left}td{vertical-align:middle}td.cat{background-color: #C2C6BA;font-weight:bold;height:20px;letter-spacing:1px;text-indent:4px}td.genmed,.genmed{font-size:11px}td.rowpic{background: #C2C6BA}td.spacerow{background: #E5E6E2}th{background-color: #FADD31;background-image:url(images/cellpic3.gif);background-repeat:repeat-x;color: #68685E;font-size:11px;font-weight:bold;line-height:16px;height:16px;padding-left:8px;padding-right:8px;text-align:center;white-space:nowrap}.admin,.mod{font-size:11px;font-weight:bold}.admin,a.admin,a.admin:visited{color: #FFA34F}.bodyline{background: #FFF;border:1px solid #98AAB1}.center{text-align:center}.code{background: #FAFAFA;border:1px solid #D1D7DC;color: #060;font:12px Courier,"Courier New",sans-serif;padding:5px}.errorline{background: #E5E6E2;border:1px solid #8F8B8B;color:#D92A2A}.explaintitle{color: #5C81B1;font-size:11px;font-weight:bold}.forumline{background: #FFF}.gensmall{font-size:10px}.h1-font{color: #069;display:inline;font:bold 13px Verdana,Arial,Helvetica,sans-serif;margin:0;text-decoration:none}.h2-font{display:inline;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.height1{height:1px}.height22{height:22px}.height25{height:25px}.height28{height:28px}.height30{height:30px}.height40{height:40px}.helpline{border:0 solid;font-size:10px}.imgfolder{margin:1px 4px 1px 4px}.imgspace{margin-left:1px;margin-right:2px}.imgtopic,.imgicon{margin-left:3px}.left{text-align:left}.maintitle,h1,h2{color: #5C81B1;font:bold 20px/120% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.maxwidth{width:100%}.mod,a.mod,a.mod:visited{color: #060}.name{font-size:11px;font-weight:bold}.nav{font-size:11px;font-weight:bold}.nowrap{white-space:nowrap}.postbody{font-size:12px;line-height:125%}.postbody a{text-decoration:underline}.postdetails{color: #00396A;font-size:10px}.quote{background: #F3F3EF;border:1px solid #C2C6BA;color: #069;font-size:11px;line-height:125%}.right{text-align:right}.row1{background: #F0F0EB}.row2,.helpline{background: #E5E6E2}.row3{background: #DBDBD4}.subtitle,h2{font:bold 18px/180% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.topictitle{color: #000;font-size:11px;font-weight:bold}.underline{text-decoration:underline}.top{vertical-align:top}.image-hspace{margin-right:3px}.clear{clear:both}

View File

@@ -1,91 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<!-- comments get removed -->
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Dave Shea" />
<!-- also whitespace around block or undisplayed elements -->
<meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display" />
<meta name="description" content="A demonstration of what can be accomplished visually through CSS-based design." />
<meta name="robots" content="all" />
<title>css Zen Garden: The Beauty in CSS Design</title>
<!-- to correct the unsightly Flash of Unstyled Content. http://www.bluerobot.com/web/css/fouc.asp -->
<script type="text/javascript"><!--
// js comment inside SCRIPT element
var is = {
ie: navigator.appName == 'Microsoft Internet Explorer',
java: navigator.javaEnabled(),
ns: navigator.appName == 'Netscape',
ua: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
is.ie = is.ns = false;
is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
is.ie = is.ns = false;
is.gecko = true;
}
// --></script>
<script type="text/javascript">
//<![CDATA[
var i = 0;
while (++i < 10)
{
// ...
}
//]]>
</script>
<script type="text/javascript">
/* <![CDATA[ */ i = 1; /* ]]> */
</script>
<script type="text/javascript">
(i < 1); /* CDATA needed */
</script>
<!--[if IE 6]>
<style type="text/css">
/* copyright: you'll need CDATA for this -- < & */
body {background:white;}
</style>
<![endif]-->
<style type="text/css" title="currentStyle" media="screen">
@import "/001/001.css";
/*\*/ css hack {} /* */
/* normal CSS comment */
/*/*/ css hack {} /* */
css hack {
display/**/:/**/none;
display:none;
}
</style>
<link
rel="Shortcut Icon"
type="image/x-icon"
href="http://www.csszengarden.com/favicon.ico" />
<link
rel="alternate"
type="application/rss+xml"
title="RSS"
href="http://www.csszengarden.com/zengarden.xml" />
</head>
<body id="css-zen-garden">
<div id="container">
<div id="pageHeader">
<h1><span>css Zen Garden</span></h1>
<h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym> Design</span></h2>
</div>
<pre>
White space is important here!
</pre>
<div id="quickSummary">
<p class="p1"><span>A demonstration of what can be accomplished visually through <acronym title="Cascading Style Sheets">CSS</acronym>-based design. Select any style sheet from the list to load it into this page.</span></p>
<p class="p2"><span>Download the sample <a href="/zengarden-sample.html" title="This page's source HTML code, not to be modified.">html file</a> and <a href="/zengarden-sample.css" title="This page's sample CSS, the file you may modify.">css file</a></span></p>
</div>
</div>
</body>
</html>

View File

@@ -1,13 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" ><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><meta name="author" content="Dave Shea" /><meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display" /><meta name="description" content="A demonstration of what can be accomplished visually through CSS-based design." /><meta name="robots" content="all" /><title>css Zen Garden: The Beauty in CSS Design</title><script type="text/javascript">var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
is.mac=is.ua.indexOf('mac')>=0;if(is.ua.indexOf('opera')>=0){is.ie=is.ns=false;is.opera=true;}
if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}</script><script type="text/javascript">/*<![CDATA[*/var i=0;while(++i<10)
{}/*]]>*/</script><script type="text/javascript">i=1;</script><script type="text/javascript">/*<![CDATA[*/(i<1);/*]]>*/</script><!--[if IE 6]><style type="text/css">/*<![CDATA[*//* copyright: you'll need CDATA for this -- < & */body{background:white}/*]]>*/</style><![endif]--><style type="text/css" title="currentStyle" media="screen">@import "/001/001.css";/*\*/css hack{}/**//*/*/css hack{}/**/css hack{display/**/:/**/none;display:none}</style><link
rel="Shortcut Icon"
type="image/x-icon"
href="http://www.csszengarden.com/favicon.ico" /><link
rel="alternate"
type="application/rss+xml"
title="RSS"
href="http://www.csszengarden.com/zengarden.xml" /></head><body id="css-zen-garden"><div id="container"><div id="pageHeader"><h1><span>css Zen Garden</span></h1><h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym> Design</span></h2></div><pre>
White space is important here!
</pre><div id="quickSummary"><p class="p1"><span>A demonstration of what can be accomplished visually through <acronym title="Cascading Style Sheets">CSS</acronym>-based design. Select any style sheet from the list to load it into this page.</span></p><p class="p2"><span>Download the sample <a href="/zengarden-sample.html" title="This page's source HTML code, not to be modified.">html file</a> and <a href="/zengarden-sample.css" title="This page's sample CSS, the file you may modify.">css file</a></span></p></div></div></body></html>

View File

@@ -1,32 +0,0 @@
// is.js
// (c) 2001 Douglas Crockford
// 2001 June 3
// is
// The -is- object is used to identify the browser. Every browser edition
// identifies itself, but there is no standard way of doing it, and some of
// the identification is deceptive. This is because the authors of web
// browsers are liars. For example, Microsoft's IE browsers claim to be
// Mozilla 4. Netscape 6 claims to be version 5.
var is = {
ie: navigator.appName == 'Microsoft Internet Explorer',
java: navigator.javaEnabled(),
ns: navigator.appName == 'Netscape',
ua: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
is.ie = is.ns = false;
is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
is.ie = is.ns = false;
is.gecko = true;
}

View File

@@ -1,3 +0,0 @@
var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
is.mac=is.ua.indexOf('mac')>=0;if(is.ua.indexOf('opera')>=0){is.ie=is.ns=false;is.opera=true;}
if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}

View File

@@ -1,168 +0,0 @@
var MrClay = window.MrClay || {};
/**
* Simplified access to/manipulation of the query string
*
* Based on: http://adamv.com/dev/javascript/files/querystring.js
* Design pattern: http://www.litotes.demon.co.uk/js_info/private_static.html#wConst
*/
MrClay.QueryString = function(){
/**
* @static
* @private
*/
var parse = function(str) {
var assignments = str.split('&')
,obj = {}
,propValue;
for (var i = 0, l = assignments.length; i < l; ++i) {
propValue = assignments[i].split('=');
if (propValue.length > 2
|| -1 != propValue[0].indexOf('+')
|| propValue[0] == ''
) {
continue;
}
if (propValue.length == 1) {
propValue[1] = propValue[0];
}
obj[unescape(propValue[0])] = unescape(propValue[1].replace(/\+/g, ' '));
}
return obj;
};
/**
* Constructor (MrClay.QueryString becomes this)
*
* @param mixed A window object, a query string, or empty (default current window)
*/
function construct_(spec) {
spec = spec || window;
if (typeof spec == 'object') {
// get querystring from window
this.window = spec;
spec = spec.location.search.substr(1);
} else {
this.window = window;
}
this.vars = parse(spec);
}
/**
* Reload the window
*
* @static
* @public
* @param object vars Specify querystring vars only if you wish to replace them
* @param object window_ window to be reloaded (current window by default)
*/
construct_.reload = function(vars, window_) {
window_ = window_ || window;
vars = vars || (new MrClay.QueryString(window_)).vars;
var l = window_.location
,currUrl = l.href
,s = MrClay.QueryString.toString(vars)
,newUrl = l.protocol + '//' + l.hostname + l.pathname
+ (s ? '?' + s : '') + l.hash;
if (currUrl == newUrl) {
l.reload();
} else {
l.assign(newUrl);
}
};
/**
* Get the value of a querystring var
*
* @static
* @public
* @param string key
* @param mixed default_ value to return if key not found
* @param object window_ window to check (current window by default)
* @return mixed
*/
construct_.get = function(key, default_, window_) {
window_ = window_ || window;
return (new MrClay.QueryString(window_)).get(key, default_);
};
/**
* Reload the page setting one or multiple querystring vars
*
* @static
* @public
* @param mixed key object of query vars/values, or a string key for a single
* assignment
* @param mixed null for multiple settings, the value to assign for single
* @param object window_ window to reload (current window by default)
*/
construct_.set = function(key, value, window_) {
window_ = window_ || window;
(new MrClay.QueryString(window_)).set(key, value).reload();
};
/**
* Convert an object of query vars/values to a querystring
*
* @static
* @public
* @param object query vars/values
* @return string
*/
construct_.toString = function(vars) {
var pieces = [];
for (var prop in vars) {
pieces.push(escape(prop) + '=' + escape(vars[prop]));
}
return pieces.join('&');
};
/**
* @public
*/
construct_.prototype.reload = function() {
MrClay.QueryString.reload(this.vars, this.window);
return this;
};
/**
* @public
*/
construct_.prototype.get = function(key, default_) {
if (typeof default_ == 'undefined') {
default_ = null;
}
return (this.vars[key] == null)
? default_
: this.vars[key];
};
/**
* @public
*/
construct_.prototype.set = function(key, value) {
var obj = {};
if (typeof key == 'string') {
obj[key] = value;
} else {
obj = key;
}
for (var prop in obj) {
if (obj[prop] == null) {
delete this.vars[prop];
} else {
this.vars[prop] = obj[prop];
}
}
return this;
};
/**
* @public
*/
construct_.prototype.toString = function() {
return QueryString.toString(this.vars);
};
return construct_;
}(); // define and execute

View File

@@ -1,24 +0,0 @@
// http://mrclay.org/
(function(){
var
reMailto = /^mailto:my_name_is_(\S+)_and_the_domain_is_(\S+)$/,
reRemoveTitleIf = /^my name is/,
oo = window.onload,
fixHrefs = function() {
var i = 0, l, m;
while (l = document.links[i++]) {
// require phrase in href property
if (m = l.href.match(reMailto)) {
l.href = 'mailto:' + m[1] + '@' + m[2];
if (reRemoveTitleIf.test(l.title)) {
l.title = '';
}
}
}
};
// end var
window.onload = function() {
oo && oo();
fixHrefs();
};
})();

View File

@@ -1,32 +0,0 @@
// is.js
// (c) 2001 Douglas Crockford
// 2001 June 3
// is
// The -is- object is used to identify the browser. Every browser edition
// identifies itself, but there is no standard way of doing it, and some of
// the identification is deceptive. This is because the authors of web
// browsers are liars. For example, Microsoft's IE browsers claim to be
// Mozilla 4. Netscape 6 claims to be version 5.
var is = {
ie: navigator.appName == 'Microsoft Internet Explorer',
java: navigator.javaEnabled(),
ns: navigator.appName == 'Netscape',
ua: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
is.ie = is.ns = false;
is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
is.ie = is.ns = false;
is.gecko = true;
}

View File

@@ -1 +0,0 @@
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('j 1={5:2.7==\'m k i\',g:2.h(),6:2.7==\'l\',3:2.u.s(),t:9(2.b.r(q))||9(2.b),n:2.o==\'p\'}1.a=1.3.4(\'a\')>=0;d(1.3.4(\'c\')>=0){1.5=1.6=e;1.c=8}d(1.3.4(\'f\')>=0){1.5=1.6=e;1.f=8}',31,31,'|is|navigator|ua|indexOf|ie|ns|appName|true|parseFloat|mac|appVersion|opera|if|false|gecko|java|javaEnabled|Explorer|var|Internet|Netscape|Microsoft|win|platform|Win32|21|substr|toLowerCase|version|userAgent'.split('|'),0,{}))

View File

@@ -1,32 +0,0 @@
<?php
require '_inc.php';
require_once $thisDir . '/../lib/Minify/CSS.php';
// build test file list
$d = dir(dirname(__FILE__) . '/css');
while (false !== ($entry = $d->read())) {
if (preg_match('/^([\w\\-]+)\.css$/', $entry, $m)) {
$list[] = $m[1];
}
}
$d->close();
foreach ($list as $item) {
$options = ($item === 'paths')
? array('prependRelativePath' => '../')
: array();
$src = file_get_contents($thisDir . '/css/' . $item . '.css');
$minExpected = file_get_contents($thisDir . '/css/' . $item . '.min.css');
$minOutput = Minify_CSS::minify($src, $options);
assertTrue($minExpected === $minOutput, 'Minify_CSS : ' . $item);
if ($minExpected !== $minOutput) {
echo "\n---Source\n\n{$src}";
echo "\n---Expected\n\n{$minExpected}";
echo "\n---Output\n\n{$minOutput}\n\n\n\n";
}
}

View File

@@ -1,22 +0,0 @@
<?php
require '_inc.php';
require_once $thisDir . '/../lib/Minify/HTML.php';
require_once $thisDir . '/../lib/Minify/CSS.php';
require_once $thisDir . '/../lib/Minify/Javascript.php';
$src = file_get_contents($thisDir . '/html/before.html');
$minExpected = file_get_contents($thisDir . '/html/before.min.html');
$minOutput = Minify_HTML::minify($src, array(
'cssMinifier' => array('Minify_CSS', 'minify')
,'jsMinifier' => array('Minify_Javascript', 'minify')
));
$passed = assertTrue($minExpected === $minOutput, 'Minify_HTML');
echo "\n---Output: " .strlen($minOutput). " bytes\n\n{$minOutput}";
if (! $passed) {
echo "\n\n\n\n---Expected: " .strlen($minExpected). " bytes\n\n{$minExpected}";
}
echo "\n\n---Source: " .strlen($src). " bytes\n\n{$src}";

View File

@@ -1,16 +0,0 @@
<?php
require '_inc.php';
require_once $thisDir . '/../lib/Minify/Javascript.php';
$src = file_get_contents($thisDir . '/js/before.js');
$minExpected = file_get_contents($thisDir . '/js/before.min.js');;
$minOutput = Minify_Javascript::minify($src);
$passed = assertTrue($minExpected == $minOutput, 'Minify_Javascript converts before.js to before.min.js');
echo "\n---Output: " .strlen($minOutput). " bytes\n\n{$minOutput}";
if (! $passed) {
echo "\n\n\n\n---Expected: " .strlen($minExpected). " bytes\n\n{$minExpected}";
}
echo "\n\n---Source: " .strlen($src). " bytes\n\n{$src}";

View File

@@ -1,29 +0,0 @@
<?php
/**
* Note: All Minify class are E_STRICT except for Cache_Lite_File.
*/
error_reporting(E_ALL);
ini_set('display_errors', 1);
// setup
$cachePath = $_SERVER['DOCUMENT_ROOT'] . '/_cache/private';
ini_set('include_path',
'.'
. PATH_SEPARATOR . '../lib'
. PATH_SEPARATOR . ini_get('include_path')
);
require 'Minify.php';
// cache output files on filesystem
Minify::useServerCache($cachePath);
//Minify::$cacheUnencodedVersion = false;
// serve an array of files as one
Minify::serve('Files', array(
dirname(__FILE__) . '/minify/email.js'
,dirname(__FILE__) . '/minify/QueryString.js'
));

View File

@@ -1,16 +0,0 @@
<?php
require '_inc.php';
require_once $thisDir . '/../lib/Minify/Packer.php';
$src = file_get_contents($thisDir . '/packer/before.js');
$minExpected = file_get_contents($thisDir . '/packer/before.min.js');
$minOutput = Minify_Packer::minify($src);
$passed = assertTrue($minExpected === $minOutput, 'Minify_Packer');
echo "\n---Output: " .strlen($minOutput). " bytes\n\n{$minOutput}";
if (! $passed) {
echo "\n\n\n\n---Expected: " .strlen($minExpected). " bytes\n\n{$minExpected}";
}
echo "\n\n---Source: " .strlen($src). " bytes\n\n{$src}";

View File

@@ -1,15 +1,18 @@
<?php
/**
* Set $minifyCachePath to a PHP-writeable path to enable server-side caching
* in all examples.
* Add the location of Minify's "lib" directory to the include_path. In
* production this could be done via .htaccess or some other method.
*/
$minifyCachePath = '';
// get lib in include path
ini_set('include_path',
dirname(__FILE__) . '/../lib'
. PATH_SEPARATOR . ini_get('include_path')
);
/**
* Set $minifyCachePath to a PHP-writeable path to enable server-side caching
* in all examples and tests.
*/
$minifyCachePath = '';
?>