Download the PHP package himanverma/cakephp-3.x-assets-bundler without Composer

On this page you can find all versions of the php package himanverma/cakephp-3.x-assets-bundler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-3.x-assets-bundler

CakePHP 3 Assets Bundler and Minifier Plugin

About

Forked from http://github.com/trentrichardson/cakephp-shrink Only updated the the JsMinifier with a better version which is compatible with angular.

The Shrink plugin compiles, combines, and minifies javascript and css. It currently has support for native javascript and css, Less (php and node versions), Sass (php and ruby versions), CoffeeScript, and TypeScript.

Shrink is a minimal configuration plugin. For a super powerful, configurable asset minifier look into Mark Story's asset_compress instead.

Installation

This version is for CakePHP 3, for other versions of CakePHP check the branches on Github.

It is recommended to use composer to install: "himanverma/cakephp-3.x-assets-bundler": "~3.0". Then enable your plugin in bootstrap.php Plugin::load('Shrink'); or Plugin::loadAll();.

You can also manually download Shrink and place into app/Plugin folder

Enable the plugin in bootstrap.php with Plugin::load('Shrink',['autoload'=>true]); or Plugin::loadAll();. When manually installing you need to set the autoload flag to true.

Add "Shrink.Shrink" to your $helpers property in your controller. Likely AppController.php.

Usage

You use Shrink in the same way you already use the Html helper for js and css. The slight differences are that you must include the file extension (since you can now process less, sass, coffee), and the parameters following the files.

Lets say you have a layout, and a view in the users controller. The view might have at the top:

Then in the layout you have:

Shrink will see that there are views passing js and css as well as layouts and merge them together appropriately (layouts css and js, then views css and js)

Once fetch is called that type's queue is cleared and you can queue again.

Options

Options are passed just like other helpers.

The available options to pass are currently:

Extending

Extending Shrink is extremely simple, and can likely be done with only a few lines of code. There are two abstractions, Compilers and Compressors.

Compilers are for file types like Coffee, Less, etc. These can be found in the app/Plugin/Shrink/src/Lib/ShrinkCompiler folder. The file and class name goes by the file extension. Less files have a .less extension, so will create ShrinkCompilerLess.php. Each compiler must set the $resultType variable to 'js' or 'css' (the end result type), and implement the compile method.

Compressors are for minifying the code after it has been compiled to js or css. These can be found in app/Plugin/Shrink/src/Lib/ShrinkCompressor. The file and class name goes by the option you set in settings (the minifier option for js or css). So if you pass the minifier option for css to be cssmin, the file name will be ShrinkCompressorCssmin.php. Each compressor class must implement the compress method.

The easiest way to extend a compiler or compressor is to simply copy one of the existing versions. You will also notice compilers and compressors extend ShrinkBase. This is a utility class which currently provides a "cmd" method to execute commands.

Testing

If you are making changes it is a good idea to create tests and ensure your new code is in a passing state. Tests are run via phpunit. Since cakephp-shrink provides support for command line utilities and composer packages you must install them before tests can run.

Depending on your setup you may need to use sudo. To run tests simply call phpunit or vendor/bin/phpunit.


All versions of cakephp-3.x-assets-bundler with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.16
composer/installers Version *
wyrihaximus/html-compress Version 1.2.0
cakephp/cakephp Version ~3.0
leafo/lessphp Version 0.5.0
leafo/scssphp Version 0.1.1
natxet/cssmin Version 3.0.2
tedivm/jshrink Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package himanverma/cakephp-3.x-assets-bundler contains the following files

Loading the files please wait ....