From 33b4eb0cf3523027779615f2d8134d9e3b22d8f3 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 13 Jan 2017 21:31:43 +0100 Subject: [PATCH] add fronend asset compression --- composer.json | 3 +- composer.lock | 189 ++++++++++++++++++++++++++++++++++++++- frontend/config/main.php | 10 ++- 3 files changed, 198 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 31863aa..cc65f10 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,8 @@ "mpdf/mpdf": "^6.0", "os/php-excel": "^2.1", "phpoffice/phpexcel": "^1.8", - "2amigos/yii2-tinymce-widget": "~1.1" + "2amigos/yii2-tinymce-widget": "~1.1", + "iisns/yii2-assets-compress": "*" }, "require-dev": { "yiisoft/yii2-codeception": "*", diff --git a/composer.lock b/composer.lock index 6c59e44..def3bce 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f8904c887de6d8934d7e32a613a802b4", - "content-hash": "b1809c8690ea12eaadb899a9549ef697", + "hash": "6f107bd4aac24595297e9f71bfd031f3", + "content-hash": "42a9442876f84ea41b6767df22460fcf", "packages": [ { "name": "2amigos/yii2-tinymce-widget", @@ -740,6 +740,53 @@ ], "time": "2013-11-30 08:25:19" }, + { + "name": "iisns/yii2-assets-compress", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/iisns/yii2-assets-compress.git", + "reference": "37009a8b0f4b3bcdd417b223db0d3fb6e9c26034" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/iisns/yii2-assets-compress/zipball/37009a8b0f4b3bcdd417b223db0d3fb6e9c26034", + "reference": "37009a8b0f4b3bcdd417b223db0d3fb6e9c26034", + "shasum": "" + }, + "require": { + "mrclay/minify": "*", + "natxet/cssmin": "*", + "tedivm/jshrink": "*", + "yiisoft/yii2": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "iisns\\assets\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Shiyang", + "email": "dr@shiyang.me" + } + ], + "description": "This solution enables you to dynamically combine js and css files to optimize the html page.", + "keywords": [ + "JS", + "assets", + "compress", + "css", + "iisns", + "yii2" + ], + "time": "2016-02-12 14:59:50" + }, { "name": "kartik-v/bootstrap-fileinput", "version": "v4.2.7", @@ -1905,6 +1952,98 @@ ], "time": "2015-03-01 10:27:49" }, + { + "name": "mrclay/minify", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/mrclay/minify.git", + "reference": "f4cb31135d288f951bb0af1f23a03d4c00ba9446" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mrclay/minify/zipball/f4cb31135d288f951bb0af1f23a03d4c00ba9446", + "reference": "f4cb31135d288f951bb0af1f23a03d4c00ba9446", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "php": ">=5.2.1" + }, + "require-dev": { + "tubalmartin/cssmin": "~2.4.8" + }, + "suggest": { + "tubalmartin/cssmin": "Support minify with CSSMin (YUI PHP port)" + }, + "type": "library", + "autoload": { + "classmap": [ + "min/lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Stephen Clay", + "email": "steve@mrclay.org", + "role": "Developer" + } + ], + "description": "Minify is a PHP5 app that helps you follow several rules for client-side performance. It combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers", + "homepage": "http://code.google.com/p/minify/", + "time": "2016-03-08 11:49:57" + }, + { + "name": "natxet/CssMin", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/natxet/CssMin.git", + "reference": "92de3fe3ccb4f8298d31952490ef7d5395855c39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/natxet/CssMin/zipball/92de3fe3ccb4f8298d31952490ef7d5395855c39", + "reference": "92de3fe3ccb4f8298d31952490ef7d5395855c39", + "shasum": "" + }, + "require": { + "php": ">=5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joe Scylla", + "email": "joe.scylla@gmail.com", + "homepage": "https://profiles.google.com/joe.scylla" + } + ], + "description": "Minifying CSS", + "homepage": "http://code.google.com/p/cssmin/", + "keywords": [ + "css", + "minify" + ], + "time": "2015-09-25 11:13:11" + }, { "name": "os/php-excel", "version": "2.1", @@ -2104,6 +2243,52 @@ ], "time": "2015-06-06 14:19:39" }, + { + "name": "tedivm/jshrink", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/tedious/JShrink.git", + "reference": "688527a2e854d7935f24f24c7d5eb1b604742bf9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tedious/JShrink/zipball/688527a2e854d7935f24f24c7d5eb1b604742bf9", + "reference": "688527a2e854d7935f24f24c7d5eb1b604742bf9", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "0.4.0", + "phpunit/phpunit": "4.0.*", + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "autoload": { + "psr-0": { + "JShrink": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Robert Hafner", + "email": "tedivm@tedivm.com" + } + ], + "description": "Javascript Minifier built in PHP", + "homepage": "http://github.com/tedious/JShrink", + "keywords": [ + "javascript", + "minifier" + ], + "time": "2015-07-04 07:35:09" + }, { "name": "tinymce/tinymce", "version": "4.3.12", diff --git a/frontend/config/main.php b/frontend/config/main.php index 505b6ba..8a43570 100644 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -10,9 +10,17 @@ return [ 'id' => 'app-frontend', 'name' =>'Fitness recepció', 'basePath' => dirname(__DIR__), - 'bootstrap' => ['log'], + 'bootstrap' => ['log','assetsAutoCompress'], 'controllerNamespace' => 'frontend\controllers', 'components' => [ + 'assetsAutoCompress' => + [ + 'class' => '\iisns\assets\AssetsCompressComponent', + 'enabled' => true, + 'jsCompress' => true, + 'cssFileCompile' => true, + 'jsFileCompile' => true, + ], 'request' => [ 'enableCsrfValidation'=>false, ],