Skip to content

Commit

Permalink
Fixes:
Browse files Browse the repository at this point in the history
 - http & https integration
 - loading files in "debug mode"
  • Loading branch information
bitboxrk committed Feb 11, 2019
1 parent 5414eca commit 57b1cbb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Minifier Changelog

## 1.0.1 - 2019-02-11
### Fixed
- Fixed a bug when loading files with http:// or https://
- Fixed a bug in "debug mode", when the minifier is disabled ([#2](https://github.com/bitboxde/minifier/issues/2))

## 1.0.0 - 2019-01-25
### Added
- Initial release
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bitboxde/minifier",
"description": "CSS, JS and HTML-Minifier-Plugin for Craft 3",
"type": "craft-plugin",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [
"craft",
"cms",
Expand Down
16 changes: 14 additions & 2 deletions src/services/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public function registerJsFile($url, $options = [], $targetFile = null) {
protected function addFile($type, $url, $options = [], $targetFile = null) {
$registerMethod = sprintf('register%sFile', $type);

$url = str_replace('//', '/', $url);

if($this->doMinify && $this->canMinifyFile($url)) {
$url = str_replace('//', '/', $url);

$originUrl = $url;
$url = \Yii::getAlias($url);

Expand All @@ -72,6 +72,18 @@ protected function addFile($type, $url, $options = [], $targetFile = null) {
}
}
} else {
$path = '';

if($type === 'Js') {
$path = \Craft::getAlias(Minifier::getInstance()->getSettings()->jsPath);
} elseif($type === 'Css') {
$path = \Craft::getAlias(Minifier::getInstance()->getSettings()->cssPath);
}

$alias = \Craft::getAlias($url);
$url = str_replace($alias, \Craft::getAlias($path), $url);


\Craft::$app->getView()->$registerMethod($url, $options, $targetFile);
}

Expand Down

0 comments on commit 57b1cbb

Please sign in to comment.