mikefunk/bustersphp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mikefunk/bustersphp

Composer 安装命令:

composer require mikefunk/bustersphp

包简介

A simple class to generate js/css tags with cache names from busters.json. This is related to gulp-buster.

README 文档

README

Build Status

BustersPhp

A simple class to generate js/css tags with cache names from busters.json. If you use gulp-buster to create a busters.json, it will look something like this:

{
    "path/to/app.min.css": "f77f5bee5ef6a19bf63fe66aa0971576",
    "path/to/app.min.js": "03cbc5dc0b5b117264ae74515cd3fb76"
}

Then you can put <?=$bustersPhp->assets()?> in your view and it will display like this:

<link href="//mysite.com/path/to/app.min.f77f5bee5ef6a19bf63fe66aa0971576.css" rel="stylesheet">
<script src="//mysite.com/path/to/app.min.03cbc5dc0b5b117264ae74515cd3fb76.js"></script>

Installation

Get composer, then put this in your composer.json in the "require" block:

"mikefunk/bustersphp": "1.1.*"

then run composer update.

Usage

  • use gulp-buster to generate combined css/js cache files with the hash as the file name
  • add BustersPhp to your PHP application via composer: composer require MikeFunk/BustersPhp:dev-develop
  • instantiate in your php with your config passed in:
    <?php
    use MikeFunk\BustersPhp\BustersPhp;

    // optional config array - if you want to set a custom config
    $config = array(
        'rootPath'        => '//'.$_SERVER['HTTP_HOST'],
        'cssTemplate'     => '<link href="{{ROOT_PATH}}/{{FILE_PATH}}/{{FILE_NAME}}.{{HASH}}.css" rel="stylesheet">',
        'jsTemplate'      => '<script src="{{ROOT_PATH}}/{{FILE_PATH}}/{{FILE_NAME}}.{{HASH}}.js"></script>',
        'bustersJsonPath' => $_SERVER['DOCUMENT_ROOT'].'/assets/cache/busters.json',
    );
    $bustersPhp = new BustersPhp($config);
  • echo css/js in your view:
    <!-- css link tagss -->
    <?=$bustersPhp->css()?>

    <!-- js script tags -->
    <?=$bustersPhp->js()?>

    <!-- js tags and css tags -->
    <?=$bustersPhp->assets()?>

For more information check out gulp-buster

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固