makehappen/autominifier
Composer 安装命令:
composer require makehappen/autominifier
包简介
Automatically Minify and Concatenate your JS and CSS files and libraries into single files for improved application performance.
README 文档
README
Automatically Minify and Concatenate your JS and CSS files and libraries into single files for improved application performance.
Main features
- Auto minify and concatenate js and css libraries into single .min files
- Auto cache bust on changed versions
- Auto detection of environment type
Other features
- It just works, out of the box
- Set it and forget it
- No complex configurations
- No Node.js required
- No "watch" command required
- No "--production" flag required
- No configuration updates needed when adding new files
- Auto detect already minified files
- Customize destination folder and file names
- Faster than Gulp or Grunt
Install
Via Composer
$ composer require makehappen/autominifier
Basic Usage
// minifier instance with default settings $minifier = new Makehappen\AutoMinifier\Minify(); // returns "/js/app.min.js" $minifier->js(); // returns "/css/app.min.css" $minifier->css();
Post install:
-
Add env.json files to .gitignore
-
Update environment in env.json to development
{
"environment": "development"
}
- Run minifier instance again to generate .min files
Customized Usage
Custom folders and .min files:
// minifier instance with public path relative to package src folder path $minifier = new Makehappen\AutoMinifier\Minify(); $minifier->setPublicFolder('/../../../../public_html/'); // returns .min.js file path with custom destinations $minifier->js('/javascript', 'functions.min.js'); // returns .min.css file path path with custom destinations $minifier->js('/styles', 'style.min.css');
Custom list and order of files: config.json
{
"files": [
"file-1.js",
"folder2/file-2.js"
]
}
Implementation example in a Laravel project
Conventions
- By default, JavaScript files should live in the public /js folder or its sub-folders
- By default, CSS files should live in the public /css folder or its sub-folders
- Default concatenation order is alphabetical, folders first, followed by file names
- Default relative path from vendor folder to public folder is expected to be ../public
- Accepted extension files: .js, .css, .sass, .scss
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email florin@after5.io instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
makehappen/autominifier 适用场景与选型建议
makehappen/autominifier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.1k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 05 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「minify」 「grunt」 「concatenate」 「gulp」 「makehappen」 「autominifier」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 makehappen/autominifier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 makehappen/autominifier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 makehappen/autominifier 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CSS/Javascript Minificator, Compressor and Concatenator for TYPO3 - highly configurable frontend asset optimization for CSS/JS merging, minification and compression with optional body parsing, async/defer loading, inline output, data-ignore exclusions, SRI integrity validation/calculation, external
Caching and compression for Twig assets (JavaScript and CSS).
CSS & JavaScript minifier for Silverstripe
A package for pack css and javascript files
PDF Importer that supports PDF versions 1.6+. Based on: https://github.com/pauln/tcpdi
统计信息
- 总下载量: 1.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-23
