Navigation Menu

Skip to content

Commit

Permalink
Try to use composer dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Mar 8, 2015
1 parent 2965a15 commit c860f80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Lib/InlineCssLib.php
Expand Up @@ -63,10 +63,12 @@ public function process($html, $css = null) {
* @return string Result
*/
protected function _processEmogrifier($html, $css) {
//$css .= $this->_extractAndRemoveCss($html);
App::import('Vendor', 'Tools.Emogrifier', ['file' => 'Emogrifier/Emogrifier.php']);

$Emogrifier = new Emogrifier($html, $css);
if (class_exists('\Pelago\Emogrifier')) {
$Emogrifier = new \Pelago\Emogrifier($html, $css);
} else {
App::import('Vendor', 'Tools.Emogrifier', ['file' => 'Emogrifier/Emogrifier.php']);
$Emogrifier = new Emogrifier($html, $css);
}
//$Emogrifier->preserveEncoding = true;

$result = $Emogrifier->emogrify();
Expand Down
2 changes: 1 addition & 1 deletion Test/Case/Lib/InlineCssLibTest.php
Expand Up @@ -218,7 +218,7 @@ public function testProcessCompleteTemplateAlternativeEngine() {
$html = file_get_contents($path . 'email_template.html');
$result = $this->InlineCss->process($html);
$this->debug($result);
$expected = '<td style="vertical-align:top;';
$expected = '<td style="vertical-align:';
$this->assertTextContains($expected, $result);

$this->InlineCss = new InlineCssLib(['engine' => InlineCssLib::ENGINE_EMOGRIFIER]);
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Expand Up @@ -22,5 +22,8 @@
},
"extra": {
"installer-name": "Tools"
},
"suggest": {
"pelago/emogrifier": "When using InlineCss lib and CSS to inline HTML transformation."
}
}

0 comments on commit c860f80

Please sign in to comment.