Download the PHP package drmonkeyninja/cakephp-inline-css without Composer
On this page you can find all versions of the php package drmonkeyninja/cakephp-inline-css. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drmonkeyninja/cakephp-inline-css
More information about drmonkeyninja/cakephp-inline-css
Files in drmonkeyninja/cakephp-inline-css
Package cakephp-inline-css
Short Description CakePHP inline CSS plugin
License MIT
Homepage https://github.com/drmonkeyninja/cakephp-inline-css
Informations about the package cakephp-inline-css
CakePHP Inline CSS
This plugin provides a CakePHP helper that uses CssToInlineStyles to convert HTML style blocks to inline CSS on a View template. Its intended use is with generating email templates where many email clients often require styles applied directly to the elements.
Requirements
- CakePHP 3.x
Installation
This plugin should be installed using Composer:-
Then add the following line to your bootstrap.php to load the plugin.
Usage
To use this plugin you want to load the InlineCss
helper to use with your email's HTML template:-
When rendering your email template the plugin will then convert any CSS defined in an inline <style>
block in your template to inline CSS. So, if your email view template looks like this:-
It will be rendered as:-
This makes generating HTML emails a lot simpler as you can write your CSS in a more DRY approach.
I recommend you look consider deferring the sending of emails using something like the excellent Queue plugin to improve your app's response time for users when using this plugin.