spazzmarticus/e-css-tractor 问题修复 & 功能扩展

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

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

spazzmarticus/e-css-tractor

最新稳定版本:1.0.0

Composer 安装命令:

composer require spazzmarticus/e-css-tractor

包简介

Extracts CSS from HTML (Style-Tags)

README 文档

README

Extracts CSS from HTML <style>-Tags

(Also the lamest wordplay I could possibly come up with...)

How

Installation

Install via composer

composer require spazzmarticus/e-css-tractor

Usage

//Your HTML-Document with one or more <style>-Tags
$html = '<html><head><style>p { color: blue; }</style></head>...<style>h1 { background-color: green; }</style></html>'; 
$eCSStractor = new eCSStractor();
$css = $eCCStractor->extract($html);

header("Content-type: text/css");
echo $css;
p { color: blue; }
h1 { background-color: green; }

Example

Check out the example/ directory. The styles from input.html are extracted in css.php and used in usage.html.

What not

This doesn't optimize the styles. GIGO ;)

Why

I built a tool to send newsletters with. The editor for the newsletter-content had to be able to work with multiple templates (each containing unique styles). By extracting the styles from the templates I was able to dynamically change the template for a preview (outside the editor) and the styles in the editor accordingly.

Before sending the newsletter the styles are written inline by emogrifier so there was no need to change anyting.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固