Skip to content

Commit

Permalink
Merge branch 'release/4.0.3' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Nov 17, 2022
2 parents 0cabbdb + 9c10a55 commit 72fa38a
Show file tree
Hide file tree
Showing 50 changed files with 274 additions and 166 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# ImageOptimize Changelog

## 4.0.3 - 2022.11.17
### Changed
* Fixed HMR in local dev with explicit alias that resolves to the actual directory

### Fixed
* Fixed an issue where the `craft image-optimize/optimize/create` CLI command did not properly optimize all images ([#350](https://github.com/nystudio107/craft-imageoptimize/issues/350))
* Fixed an issue which caused the Imgix `auto` to no longer work for auto format ([#357](https://github.com/nystudio107/craft-imageoptimize/issues/357))
* Fixed a JavaScript console error in field settings due to Garnish shuffling around how things work for menus
* Fixed an issue where `srcsetWidth()` wouldn't return the proper variant, due to strict comparison operator ([#327](https://github.com/nystudio107/craft-imageoptimize/issues/327))
* Fixed an issue where using a transform method other than Craft along with `asset.getUrl()` in your templates could throw an exception ([#363](https://github.com/nystudio107/craft-imageoptimize/issues/363))

## 4.0.2 - 2022.07.17
### Changed
* Add `allow-plugins` to `composer.json` to allow CI tests to work
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/quality-score.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/?branch=v1) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/coverage.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/?branch=v1) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/build.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/build-status/v1) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/code-intelligence.svg?b=v1)](https://scrutinizer-ci.com/code-intelligence)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/quality-score.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/?branch=v4) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/coverage.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/?branch=v4) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/build.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/build-status/v4) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/code-intelligence.svg?b=v4)](https://scrutinizer-ci.com/code-intelligence)

# ImageOptimize plugin for Craft CMS 3.x
# ImageOptimize plugin for Craft CMS 4.x

Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like imgix or Thumbor, with zero template changes.

Expand All @@ -10,7 +10,7 @@ Automatically create & optimize responsive image transforms, using either native

## Requirements

This plugin requires Craft CMS 3.0.0 or later.
This plugin requires Craft CMS 4.0.0 or later.

## Installation

Expand All @@ -28,10 +28,6 @@ To install the plugin, follow these instructions.

You can also install ImageOptimize via the **Plugin Store** in the Craft Control Panel.

ImageOptimize works on Craft 3.x.

If you want to use ImageOptimize with Cloudinary, install the [Cloudinary](https://github.com/timkelty/craft3-cloudinary) plugin that will make Cloudinary available as a file system for Craft CMS 3.

## Documentation

Click here -> [Image Optimize Documentation](https://nystudio107.com/plugins/imageoptimize/documentation)
Expand Down
6 changes: 6 additions & 0 deletions buildchain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,30 @@ DOCKERRUN=docker container run \

.PHONY: build dev docker install clean npm

# Build the production assets
build: docker install
${DOCKERRUN} \
run build
# Start up the dev server
dev: docker install
${DOCKERRUN} \
run dev
# Start the Docker container
docker:
docker build \
. \
-t ${CONTAINER}:${TAG} \
--build-arg TAG=${TAG} \
--no-cache
# Run an npm install
install: docker
${DOCKERRUN} \
install
# Remove node_modules/* & package-lock.json
clean:
rm -rf node_modules/
rm -f package-lock.json
# Run the passed in npm command
npm: docker
${DOCKERRUN} \
$(filter-out $@,$(MAKECMDGOALS))
Expand Down
13 changes: 8 additions & 5 deletions buildchain/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,23 @@ export default defineConfig(({command}) => ({
cache: false,
}),
],
optimizeDeps: {
include: ['vue-confetti'],
},
publicDir: '../src/web/assets/public',
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'vue': 'vue/dist/vue.esm.js',
},
alias: [
{find: '@', replacement: path.resolve(__dirname, '../src/web/assets/src')},
{find: 'vue', replacement: 'vue/dist/vue.esm.js'},
],
preserveSymlinks: true,
},
server: {
fs: {
strict: false
},
host: '0.0.0.0',
origin: 'http://localhost:3001/',
origin: 'http://localhost:3001',
port: 3001,
strictPort: true,
}
Expand Down
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": "nystudio107/craft-imageoptimize",
"description": "Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like imgix, with zero template changes.",
"type": "craft-plugin",
"version": "4.0.2",
"version": "4.0.3",
"keywords": [
"craft",
"cms",
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: ImageOptimize plugin for Craft CMS 3.x
title: ImageOptimize plugin for Craft CMS
description: Documentation for the ImageOptimize plugin. The Transcoder plugin automatically creates & optimizes responsive image transforms, using either native Craft transforms or a service like imgix or Thumbor, with zero template changes
---
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/quality-score.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/?branch=v1) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/coverage.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/?branch=v1) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/build.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/build-status/v1) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-imageoptimize/badges/code-intelligence.svg?b=v1)](https://scrutinizer-ci.com/code-intelligence)

# ImageOptimize plugin for Craft CMS 3.x
# ImageOptimize plugin for Craft CMS

Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like imgix or Thumbor, with zero template changes.

Expand Down
48 changes: 11 additions & 37 deletions src/ImageOptimize.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* ImageOptimize plugin for Craft CMS 3.x
* ImageOptimize plugin for Craft CMS
*
* Automatically optimize images after they've been transformed
*
Expand Down Expand Up @@ -41,17 +41,13 @@
use craft\web\twig\variables\CraftVariable;
use craft\web\UrlManager;
use craft\web\View;
use nystudio107\imageoptimize\assetbundles\imageoptimize\ImageOptimizeAsset;
use nystudio107\imageoptimize\fields\OptimizedImages;
use nystudio107\imageoptimize\imagetransforms\CraftImageTransform;
use nystudio107\imageoptimize\imagetransforms\ImageTransformInterface;
use nystudio107\imageoptimize\models\Settings;
use nystudio107\imageoptimize\services\Optimize as OptimizeService;
use nystudio107\imageoptimize\services\OptimizedImages as OptimizedImagesService;
use nystudio107\imageoptimize\services\Placeholder as PlaceholderService;
use nystudio107\imageoptimize\services\ServicesTrait;
use nystudio107\imageoptimize\utilities\ImageOptimizeUtility;
use nystudio107\imageoptimize\variables\ImageOptimizeVariable;
use nystudio107\pluginvite\services\VitePluginService;
use yii\base\Event;
use yii\base\Exception;
use yii\base\InvalidConfigException;
Expand All @@ -67,15 +63,15 @@
* @package ImageOptimize
* @since 1.0.0
*
* @property OptimizeService $optimize
* @property PlaceholderService $placeholder
* @property OptimizedImagesService $optimizedImages
* @property ImageTransformInterface $transformMethod
* @property VitePluginService $vite
* @property Settings $settings
*/
class ImageOptimize extends Plugin
{
// Traits
// =========================================================================

use ServicesTrait;

// Static Properties
// =========================================================================

Expand Down Expand Up @@ -106,31 +102,6 @@ class ImageOptimize extends Plugin
*/
public bool $hasCpSettings = true;

/**
* @inheritdoc
*/
public function __construct($id, $parent = null, array $config = [])
{
$config['components'] = [
'optimize' => OptimizeService::class,
'optimizedImages' => OptimizedImagesService::class,
'placeholder' => PlaceholderService::class,
// Register the manifest service
'vite' => [
'class' => VitePluginService::class,
'assetClass' => ImageOptimizeAsset::class,
'useDevServer' => true,
'devServerPublic' => 'http://localhost:3001',
'serverPublic' => 'http://localhost:8000',
'errorEntry' => 'src/js/ImageOptimize.js',
'devServerInternal' => 'http://craft-imageoptimize-buildchain:3001',
'checkDevServer' => true,
],
];

parent::__construct($id, $parent, $config);
}

// Public Methods
// =========================================================================

Expand Down Expand Up @@ -366,9 +337,12 @@ static function (ImageTransformerOperationEvent $event): void {
__METHOD__
);
// Return the path to the optimized image to _createTransformForAsset()
$event->path = ImageOptimize::$plugin->optimize->handleGenerateTransformEvent(
$tempPath = ImageOptimize::$plugin->optimize->handleGenerateTransformEvent(
$event
);
if ($tempPath) {
$event->tempPath = $tempPath;
}
}
);

Expand Down
2 changes: 1 addition & 1 deletion src/assetbundles/imageoptimize/ImageOptimizeAsset.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Image Optimize plugin for Craft CMS 3.x
* Image Optimize plugin for Craft CMS
*
* Automatically optimize images after they've been transformed
*
Expand Down
Loading

0 comments on commit 72fa38a

Please sign in to comment.