maurymmarques/minify-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

maurymmarques/minify-plugin

Composer 安装命令:

composer require maurymmarques/minify-plugin

包简介

A CakePHP plugin that facilitates the use of PHP Minify with CakePHP

README 文档

README

This plugin was developed to facilitate Minify use with CakePHP

Minify is an application that combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers.

More info: http://code.google.com/p/minify

For this plugin, the Minify application is inside Vendor

Version

Written for CakePHP 2.x

Copyright

Copyright (c) 2011 Maury M. Marques

Installation

You can install this plugin using Composer, GIT Submodule, GIT Clone or Manually

[Using Composer]

Add the plugin to your project's composer.json - something like this:

{
  "require": {
    "maurymmarques/minify-plugin": "dev-master"
  },
  "extra": {
		"installer-paths": {
			"app/Plugin/Minify": ["maurymmarques/minify-plugin"]
		}
	}
}

Then just run composer install

Because this plugin has the type cakephp-plugin set in it's own composer.json, composer knows to install it inside your /Plugin directory, rather than in the usual vendors file.

[GIT Submodule]

In your app directory (app/Plugin) type:

git submodule add git://github.com/maurymmarques/minify-cakephp.git Plugin/Minify
git submodule init
git submodule update

[GIT Clone]

In your plugin directory (app/Plugin or plugins) type:

git clone https://github.com/maurymmarques/minify-cakephp.git Minify

[Manual]

  • Download the Minify archive.
  • Unzip that download.
  • Rename the resulting folder to Minify
  • Then copy this folder into app/Plugin/ or plugins

Configuration

Bootstrap the plugin in app/Config/bootstrap.php:

CakePlugin::load(array('Minify' => array('routes' => true)));

Set the configuration file in your app/Config/core.php

Configure::write('MinifyAsset', true);

If you do not want to use compression, set false.

Note

Create a folder called "minify" in app/tmp/cache and give it permission to read and write.

Usage

Enable the helper using the plugin syntax

class BakeriesController extends AppController {
    public $helpers = array('Minify.Minify');
}

This plugin uses HtmlHelper, and virtually it works in the same way.

In the view you can use something like:

echo $this->Minify->css(array('default', 'global'));
echo $this->Minify->script(array('jquery', 'interface'));

统计信息

  • 总下载量: 5.14k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 59
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 59
  • Watchers: 12
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-08