定制 salernolabs/collapser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

salernolabs/collapser

Composer 安装命令:

composer require salernolabs/collapser

包简介

A PHP media collapser with CSS and JS extensions.

README 文档

README

Latest Stable Version License Build Status

A PHP media collapser/minifier with CSS and JS extensions. Not really re-inventing the wheel this code was written years ago in my proprietary Chorizo platform. Just moving it out into it's own library. I am fully aware that many developers hate inheritance and protected members/methods. For those offended, I apologize, that's just how this was built.

Usage

Include this project with composer:

composer require salernolabs/collapser

CSS

You can create an instance of the collapser you need, default media (useless), CSS, or Javascript.

$collapser = new \SalernoLabs\Collapser\CSS();
$collapser->setDeleteComments(true);

$output = $collapser->collapse($input);

If the input CSS is:

.helloCSS {
    display: none;
}

#somecss {
    color: #ffffff;
    background: url('/images/whatever.gif');
}

The value of $output would be:

.helloCSS{display:none;}

Javascript

$collapser = new \SalernoLabs\Collapser\Javascript();
$collapser->setDeleteComments(true);

$output = $collapser->collapse($input);

If the input Javascript is:

/**
 Javascript test
 */
var x = 13;

function test(i, j, x)
{
    var output = i + j + x;

    return output;
}

//Run the function in the alert
var detail = test(1, 2, 3);
alert(detail);

The value of $output should be:

var x=13;function test(i, j, x){var output=i+j+x;return output;}var detail=test(1, 2, 3);alert(detail);

Note that it doesn't remove spaces for parameters of functions.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固