定制 thewind1984/css-optimizator 二次开发

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

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

thewind1984/css-optimizator

Composer 安装命令:

composer require thewind1984/css-optimizator

包简介

Interface accepts css files and folders / single templates files, then combines provided css files into one, compares it with provided templates, removes unused selectors and minifies final file

README 文档

README

Interface accepts css files and folders / single templates files, then combines provided css files into one, compares it with provided templates, removes unused selectors and minifies final file.
It supports twig templates also, because {% %}, {{ }} and {# #} will be deleted before check.

Latest Stable Version GitHub license

Features

  • Chains of CSS selectors like >, ~
  • Pseudo-classes (with optional sub-selectors)
  • Multiple selectors separated with , (comma)

TODO

  • Parsing of chains of CSS selectors with + separator
    • .class + .subclass
  • Parsing of selectors, which are implemented with quatro brackets
    • audio[controls]
    • [id*="xxx"], [class^="yyy"], [attr$="zzz"]
  • Implementation convertion to xPath for pseudo-classes
    • nth-child
  • Combining of duplicated selectors
    • body {margin; 0;} body {color: #000;} => body {margin: 0; color: #000;}
  • Unification / optimization the rules inside selector
    • margin: 0; margin-bottom: 10px; => margin: 0 0 10px;

Installation through Composer

composer require thewind1984/css-optimizator

Usage

require_once './vendor/autoload.php';
$cssOptimizator = new \CssOptimizator\CssOptimize\CssOptimize();
$cssOptimizator->addCssFile('path/to/assets/file.css');
$cssOptimizator->addSourceFile('path/to/templates/page.html');
$cssOptimizator->optimize()->minify()->saveContent('path/to/assets/file.min.css');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固