bvanhoekelen/php-compressor
Composer 安装命令:
composer require bvanhoekelen/php-compressor
包简介
PHP compressor merge multiple css and js files into one file
关键字:
README 文档
README
Highlight
- Merge several files into one file
- Live compiler, fast and no additional program is needed
- Allows user to write code that can be used in other projects » Code reuse
- The ability to set variables » see variable in help
- Support .css, .fcss and .js files
- Required no changes on the live server
- Reducing server load and client load time
- Optimizing assets for a higher rank in google search results » PageSpeed
- Easy to install » instalation
- Support for Laravel framework » Laravel
Workflow
-
Input
- Contains the building blocks
- Folder can be placed before the public folder, no access for external users
- For a better overview you can split easy your code in into several files
- No
@include, files are automatically merged - Ordering happened by name
-
Output
- Each extension has its own file
- Use normal html tag
<link href='compressor/take.css' rel='stylesheet'>and<script src='compressor/take.js'></script>to grab it
-
PHP compressor run (PhpCompressor::run())
- <loccation> (INPUT) directory where the .CSS, .FCSS and .JS files are
- <destination> (OUTPUT) directory that contains the
compressor/folder. Note. de destination path is without thecompressor/. This wil set in automatic - The output of PHP compressor wil set in the
compressor/folder astake.* - Run PHP compressor only in the developor environment, not in production!
(Input) (Output)
Root/ . Root/
└── Resources/ .. ..................;;. └── Public/ (!)
└── css/ (!) .. PHP compresspr ;;;;. └── compressor/ (static)
│ ├── table.css . . .::::::::::::::::::;;:' ├── take.css
│ ├── alert.css :' └── take.js
│ ├── button.css
│ ...
└── js/ (!)
│ ├── table.js
│ ├── alert.js
│ ├── button.js
│ ...
..
(PHP compressor)
PhpCompressor::run(['resources/assets/css/', 'resources/assets/js/'], 'public/');
PhpCompressor::run( [ <loccation> , <location>, ... ], <destination> ); // explanation!
Help, docs and links
Instalation
Install with Laravel
Get PHP compressor by running the composer command in the command line.
$ composer require bvanhoekelen/php-compressor
Open the AppServiceProvider.php located in App\Providers\.
// Add namespace at the top use PhpCompressor\PhpCompressor; // Place the code in the `public function boot()`. if(config('app.debug')) // DON'T USE ON PRODUCTION !! PhpCompressor::run(['resources/assets/css/', 'resources/assets/js/'], 'public/');
Place the code in <head> from the html file.
<!-- PHP compressor --> <link href="{{ asset('/compressor/take.css') }}" rel="stylesheet"> <script src="{{ asset('/compressor/take.js') }}"></script>
Install with composer
Get PHP compressor by running the composer command in the command line.
$ composer require bvanhoekelen/php-compressor
Run PHP compressor by place code before the view is draw.
// Require vender autoload require_once('../vendor/autoload.php'); // Use namespace use PhpCompressor\PhpCompressor; // Switch which determines if environment is production $production = false; // Run php conpressor if( ! $production ) // DON'T USE ON PRODUCTION !! PhpCompressor::run(['resources/css/', 'resources/js/'], 'public/');
Place the code in <head> from the html file.
<!-- PHP compressor --> <link href='compressor/take.css' rel='stylesheet'> <script src='compressor/take.js'></script>
统计信息
- 总下载量: 162
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2016-09-23
