Skip to content

Commit

Permalink
Now using ivopetkov/client-packages-bearframework-addon.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivopetkov committed May 13, 2019
1 parent dcdc4e1 commit 70147bf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
'require' => [
'bearcms/bearframework-addon',
'bearframework/localization-addon',
'ivopetkov/client-shortcuts-bearframework-addon'
'ivopetkov/client-packages-bearframework-addon'
]
]);
2 changes: 1 addition & 1 deletion components/embedElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
}
?><html>
<head>
<link rel="client-shortcuts-embed" name="-bearcms-embed-element-responsively-lazy">
<link rel="client-packages-embed" name="-bearcms-embed-element-responsively-lazy">
</head>
<body><?= $content ?></body>
</html>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"bearcms/bearframework-addon": "1.*",
"bearframework/localization-addon": "0.2.*",
"ivopetkov/html5-dom-document-php": "2.*",
"ivopetkov/client-shortcuts-bearframework-addon": "0.1.*"
"ivopetkov/client-packages-bearframework-addon": "0.1.*"
},
"autoload": {
"files": ["autoload.php"]
Expand Down
17 changes: 4 additions & 13 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,10 @@
]);
};

$app->clientShortcuts
->add('-bearcms-embed-element-responsively-lazy', function(IvoPetkov\BearFrameworkAddons\ClientShortcut $shortcut) use ($context) {
$shortcut->requirements[] = [
'type' => 'file',
'url' => $context->assets->getURL('assets/responsivelyLazy.min.js', ['cacheMaxAge' => 999999999, 'version' => 2]),
'async' => true,
'mimeType' => 'text/javascript'
];
$shortcut->requirements[] = [
'type' => 'text',
'value' => '.responsively-lazy:not(img){position:relative;height:0;}.responsively-lazy:not(img)>img{position:absolute;top:0;left:0;width:100%;height:100%}img.responsively-lazy{width:100%;}',
'mimeType' => 'text/css'
];
$app->clientPackages
->add('-bearcms-embed-element-responsively-lazy', 1, function(IvoPetkov\BearFrameworkAddons\ClientPackage $package) use ($context) {
$package->addJSFile($context->assets->getURL('assets/responsivelyLazy.min.js', ['cacheMaxAge' => 999999999, 'version' => 2]), ['async' => true]);
$package->addCSSCode('.responsively-lazy:not(img){position:relative;height:0;}.responsively-lazy:not(img)>img{position:absolute;top:0;left:0;width:100%;height:100%}img.responsively-lazy{width:100%;}');
});
};
});

0 comments on commit 70147bf

Please sign in to comment.