Skip to content

Commit

Permalink
Preparing release of v150424.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswsinc committed Apr 24, 2015
1 parent 8b5f7ce commit 07d69ec
Show file tree
Hide file tree
Showing 20 changed files with 418 additions and 252 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*~
*.bak

# Composer
vendor/

# Node
node_modules/
npm-debug.log
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## v150424

- PSR 1, 2, 4 conformity.
- Composer dependency compat.
- Major restructuring and namespace changes.
- Adding support for JSON compression.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Combines & compresses CSS/JS/HTML code.

```php
<?php
require_once 'html-compressor.phar';
require_once 'websharks-html-compressor.phar';
$html_compressor = new WebSharks\HtmlCompressor\Core();
ob_start(array($html_compressor, 'compress'));
```
Expand Down Expand Up @@ -124,7 +124,7 @@ All of these compression options are enabled by default, but you can modify this

```php
<?php
require_once 'html-compressor.phar';
require_once 'websharks-html-compressor.phar';
$html_compressor = new WebSharks\HtmlCompressor\Core();
ob_start(array($html_compressor, 'compress'));
```
Expand All @@ -133,14 +133,14 @@ ob_start(array($html_compressor, 'compress'));

**IMPORTANT NOTE:** One thing to keep in mind is that the WebSharks™ HTML Compressor works best when it's integrated together with a page caching plugin like ZenCache for WordPress; or another page caching plugin that you might prefer. **Why use a page caching plugin?** The HTML Compressor can be used on any site powered by PHP; but ideally you would cache the optimized HTML that it outputs, thereby removing the need for the HTML Compressor to analyze every single request. Of course, you *can* analyze every single request if you want to *(and the HTML Compressor has a cache of it's own to help keep things sane)*, but it's always better to store (cache) the compressed HTML output by this class. This will reduce server load and make your site even faster.

**FAQ:** Is `html-compressor.phar` the only file that I need? Yes. The other files that you see in the GitHub repo are already compressed into the PHAR file. The only file you need is the `html-compressor.phar`. A PHAR binary is made available for each official release. See: [releases](https://github.com/websharks/html-compressor/releases).
**FAQ:** Is `websharks-html-compressor.phar` the only file that I need? Yes. The other files that you see in the GitHub repo are already compressed into the PHAR file. The only file you need is the `websharks-html-compressor.phar`. A PHAR binary is made available for each official release. See: [releases](https://github.com/websharks/html-compressor/releases).

### 2. HTML Compressor as an Output Buffer (w/ Options)
*This just demonstrates how to specify an array of options.*

```php
<?php
require_once 'html-compressor.phar';
require_once 'websharks-html-compressor.phar';
$html_compressor_options = array(

'css_exclusions' => array(),
Expand Down Expand Up @@ -172,7 +172,7 @@ ob_start(array($html_compressor, 'compress'));

```php
<?php
require_once 'html-compressor.phar';
require_once 'websharks-html-compressor.phar';
$html_compressor_options = array(

'css_exclusions' => array(),
Expand Down
26 changes: 18 additions & 8 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>

<project name="HTML Compressor" default="build">
<project name="Project" default="build">

<basename property="project_basename" file="${project.basedir}" suffix="" />

<property name="build_dir" value="${project.basedir}/.~build" />

<property name="phar_file" value="${build_dir}/html-compressor.phar" />
<property name="phar_file" value="${build_dir}/websharks-${project_basename}.phar" />
<property name="phar_stub_file" value="${project.basedir}/src/phar-stub.php" />

<property name="composer_path" value="/usr/bin/env composer" />
<property name="vendor_dir" value="${project.basedir}/src/includes/vendor" />
<property name="composer_lock" value="${project.basedir}/composer.lock" />
<property name="vendor_dir" value="${project.basedir}/src/vendor" />

<target name="preamble">
<echo msg="OS: ${os.name}" />
Expand All @@ -18,6 +21,7 @@
<echo msg="Phing version: ${phing.version}" />
<echo msg="------------------------------------" />
<echo msg="Project: ${phing.project.name}" />
<echo msg="Project basename: ${project_basename}" />
<echo msg="Base directory: ${project.basedir}" />
<echo msg="------------------------------------" />
</target>
Expand All @@ -37,8 +41,11 @@
<echo msg="Deleting previous: ${vendor_dir} ..." />
<delete dir="${vendor_dir}" includeemptydirs="true" quiet="true" />
<echo msg="------------------------------------" />
<echo msg="Deleting previous: ${composer_lock} ..." />
<delete file="${composer_lock}" quiet="true" />
<echo msg="------------------------------------" />
<echo msg="Running Composer..." />
<exec command="${composer_path} install" dir="${project.basedir}" checkreturn="true" />
<exec command="${composer_path} install" dir="${project.basedir}" passthru="true" checkreturn="true" />
<echo msg="------------------------------------" />
</target>

Expand All @@ -47,11 +54,14 @@
<delete file="${phar_file}" quiet="true" />
<echo msg="------------------------------------" />
<echo msg="Creating PHAR file..." />
<pharpackage basedir="${project.basedir}/src" stub="${phar_stub_file}" destfile="${phar_file}">
<pharpackage basedir="${project.basedir}" stub="${phar_stub_file}" destfile="${phar_file}">
<fileset dir="${project.basedir}/src">
<exclude name="includes/vendor/bin/**" />
<exclude name="includes/vendor/phing/**" />
<exclude name="phar-stub.php" />
<exclude name="**/vendor/bin/**" />
<exclude name="**/phar-stub.php" />
<exclude name="**/build.xml" />
<exclude name="**/composer.json" />
<exclude name="**/composer.lock" />
<exclude name="**/.~**" />
</fileset>
</pharpackage>
<echo msg="------------------------------------" />
Expand Down
90 changes: 44 additions & 46 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
{
"name" : "websharks/html-compressor",
"homepage" : "https://github.com/websharks/html-compressor",
"description" : "Combines & compresses CSS/JS/HTML code.",
"keywords" : [
"websharks",
"html",
"compressor"
],
"type" : "library",
"license" : "GPL-3.0+",
"authors" : [
{
"name" : "websharks",
"homepage": "http://websharks-inc.com/",
"role" : "company"
},
{
"name" : "jaswsinc",
"homepage": "http://jaswsinc.com/",
"role" : "developer"
},
{
"name" : "raamdev",
"homepage": "http://raam.org/",
"role" : "developer"
}
],
"support" : {
"source": "https://github.com/websharks/html-compressor",
"issues": "https://github.com/websharks/html-compressor/issues"
},
"name": "websharks/html-compressor",
"homepage": "https://github.com/websharks/html-compressor",
"description": "Combines & compresses CSS/JS/HTML code.",
"keywords": [
"websharks",
"html",
"compressor"
],
"type": "library",
"license": "GPL-3.0+",
"authors": [{
"name": "websharks",
"homepage": "http://websharks-inc.com/",
"role": "company"
}, {
"name": "jaswsinc",
"homepage": "http://jaswsinc.com/",
"role": "developer"
}, {
"name": "raamdev",
"homepage": "http://raam.org/",
"role": "developer"
}],
"support": {
"source": "https://github.com/websharks/html-compressor",
"issues": "https://github.com/websharks/html-compressor/issues"
},

"require" : {
"php" : ">=5.3",
"phing/phing" : "dev-master",
"websharks/js-minifier": "dev-master"
},
"minimum-stability": "dev",
"prefer-stable" : true,
"require": {
"php": ">=5.3",
"ext-openssl": "*",
"ext-curl": "*",
"ext-mbstring": "*",
"websharks/js-minifier": "dev-master"
},
"minimum-stability": "dev",
"prefer-stable": true,

"autoload" : {
"psr-4": {
"WebSharks\\HtmlCompressor\\": "src/includes/classes/"
}
},
"autoload": {
"psr-4": {
"WebSharks\\HtmlCompressor\\": "src/includes/classes"
}
},

"config" : {
"vendor-dir": "src/includes/vendor"
}
"config": {
"vendor-dir": "src/vendor"
}
}
109 changes: 11 additions & 98 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
deny from all
</IfModule>

<FilesMatch "\.(js|css|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">
<IfModule authz_core_module>
Require all granted
</IfModule>
<IfModule !authz_core_module>
allow from all
</IfModule>
</FilesMatch>
Loading

0 comments on commit 07d69ec

Please sign in to comment.