承接 phpdevsr/minifyku 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

phpdevsr/minifyku

最新稳定版本:v3.0.1

Composer 安装命令:

composer require phpdevsr/minifyku

包简介

Helper versioning and minification your assets in Codeigniter 4

README 文档

README

PHPUnit PHPStan Coverage Status Downloads GitHub release (latest by date) GitHub stars GitHub license

What is Minifyku?

Minifyku is helper versioning and minification your assets with Codeigniter 4, Can be automatically use base_url().

Installation

install with composer

$ composer require phpdevsr/minifyku

Configuration

$ php spark minifyku:publish

This command will copy a config file to your app namespace. Then you can adjust it to your needs. By default, file will be present in app/Config/Minifyku.php.

public array $js = [
    'all.min.js' => [
        'bootstrap.js', 'jquery.js', 'main.js'
    ],
];

public array $css = [
    'all.min.css' => [
        'bootstrap.css', 'font-awesome.css', 'main.css'
    ],
];

This configuration will be minify and combine file bootstrap.js,jquery.js,main.js to all.min.js. Or minify and combine file bootstrap.css,font-awesome.css,main.css to all.min.css.

Since v2.0.0, new option autoMinify for you need automated minify when loaded using helper minifyku() and can be replaced by .env with minifyku.autoMinify = true. Please dont use in production, it will take more time.

public bool $autoMinify = false;

Usage

Run command for minification your all assets:

$ php spark minifyku:minify

or you want minify JS/CSS files:

$ php spark minifyku:minify-js
$ php spark minifyku:minify-css

This will prepare everything and will set up a versioning. Make sure to load a minifier helper in your controller, by calling:

helper('minifyku');

Now to generate a proper tag with desired file to load, you have to make a simple call in your code:

minifyku('all.min.js');

or

minifyku('all.min.css');

Helper will be produce:

<script defer type="text/javascript" src="http://example.com/assets/js/all.min.js?v=bc3d0dc779f1a0b521b69ed3a2b85de8"></script>

or

<link rel="stylesheet" href="http://localhost/assets/css/all.min.css?v=ec8d57dd8de143d7ef822a90fca20957">

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contrib

We does accept and encourage contributions from the community in any shape. It doesn't matter whether you can code, write documentation, or help find bugs, all contributions are welcome.

Made with contrib.rocks.

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-03