Skip to content

Commit

Permalink
Merge branch 'release/1.4.38' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Aug 20, 2018
2 parents 1fc7efa + f0de353 commit b1dea42
Show file tree
Hide file tree
Showing 69 changed files with 8,998 additions and 180 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ImageOptimize Changelog

## 1.4.38 - 2018.08.20
### Changed
* Fixed an incompatibility with the Spoon plugin by removing `matrix-field` class from field type settings
* Fixed an erroneous 2:2 aspect ratio in the default settings
* Moved to a modern webpack build config for the AdminCP
* Added install confetti

## 1.4.37 - 2018.08.09
### Changed
* Reverted an errant commit that removed a fix for propagating field data in multi-site environments
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": "1.4.37",
"version": "1.4.38",
"keywords": [
"craft",
"cms",
Expand Down
145 changes: 145 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"name": "imageoptimize",
"version": "1.0.0",
"description": "Automatically optimize images after they've been transformed",
"copyright": "nystudio107",
"main": "index.js",
"scripts": {
"dev": "webpack --config webpack.dev.js --progress --hide-modules",
"watch": "webpack --config webpack.dev.js --progress --watch --hide-modules",
"build": "webpack --config webpack.prod.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nystudio107/craft-imageoptimize.git"
},
"author": "[email protected]",
"license": "proprietary",
"bugs": {
"url": "https://github.com/nystudio107/craft-imageoptimize/issues"
},
"homepage": "https://github.com/nystudio107/craft-imageoptimize",
"paths": {
"src": {
"base": "./src/assetbundles/imageoptimize/src/",
"js": "./src/assetbundles/imageoptimize/src/js/",
"css": "./src/assetbundles/imageoptimize/src/css/"
},
"dist": {
"base": "./src/assetbundles/imageoptimize/dist/",
"public": "/cpresources/imageoptimize/",
"clean": [
"./js",
"./css"
]
},
"copyFiles": [
{
}
],
"manifest": {
"basePath": "",
"template": {
"twigCss": "./src/templates/_src/include-css-module.twig",
"twigModern": "./src/templates/_src/include-modern-module.twig",
"twigLegacy": "./src/templates/_src/include-legacy-module.twig"
},
"filename": {
"twigCss": "./src/templates/_includes/include-css-module.twig",
"twigModern": "./src/templates/_includes/include-modern-module.twig",
"twigLegacy": "./src/templates/_includes/include-legacy-module.twig"
}
},
"templates": "./src/templates/"
},
"entries": {
"imageoptimize": "ImageOptimize.js",
"welcome": "Welcome.js"
},
"babelConfig": {
"legacyBrowsers": [
"> 1%",
"last 2 versions",
"Firefox ESR"
],
"modernBrowsers": [
"last 2 Chrome versions",
"not Chrome < 60",
"last 2 Safari versions",
"not Safari < 10.1",
"last 2 iOS versions",
"not iOS < 10.3",
"last 2 Firefox versions",
"not Firefox < 54",
"last 2 Edge versions",
"not Edge < 15"
]
},
"purgeCss": {
"paths": [
"./src/templates/**/*.{twig,html}"
],
"whitelist": [
"../css/components.pcss"
],
"whitelistPatterns": [],
"extensions": [
"html",
"js",
"twig",
"vue"
]
},
"urls": {},
"vars": {
"cssName": "imageoptimize.css",
"jsName": "imageoptimize.js"
},
"devDependencies": {
"autoprefixer": "^8.1.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.10",
"cssnano": "^3.10.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.11",
"git-rev-sync": "^1.10.0",
"glob-all": "^3.1.0",
"html-webpack-plugin": "^3.2.0",
"ignore-loader": "^0.1.2",
"mini-css-extract-plugin": "^0.4.0",
"moment": "^2.21.0",
"optimize-css-assets-webpack-plugin": "^4.0.3",
"postcss": "^6.0.19",
"postcss-extend": "^1.0.5",
"postcss-hexrgba": "^1.0.0",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.1",
"postcss-nested": "^3.0.0",
"postcss-nested-ancestors": "^1.0.0",
"postcss-simple-vars": "^4.1.0",
"purgecss-webpack-plugin": "^1.2.0",
"purgecss-whitelister": "^2.1.0",
"resolve-url-loader": "^2.3.0",
"tailwindcss": "^0.6.4",
"uglifyjs-webpack-plugin": "^1.2.7",
"vue-loader": "^15.3.0",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.5.17",
"webpack": "^4.1.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^2.0.11",
"webpack-manifest-plugin": "^2.0.3",
"webpack-merge": "^4.1.2"
},
"dependencies": {
"vue": "^2.5.17",
"vue-confetti": "^0.4.1"
}
}
12 changes: 12 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
plugins: [
require('postcss-import'),
require('postcss-extend'),
require('postcss-simple-vars'),
require('postcss-nested-ancestors'),
require('postcss-nested'),
require('postcss-hexrgba'),
require('autoprefixer'),
require('tailwindcss')('./tailwind.config.js')
]
}
43 changes: 43 additions & 0 deletions src/ImageOptimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use craft\events\GenerateTransformEvent;
use craft\events\PluginEvent;
use craft\events\RegisterComponentTypesEvent;
use craft\events\RegisterUrlRulesEvent;
use craft\events\ReplaceAssetEvent;
use craft\events\VolumeEvent;
use craft\helpers\UrlHelper;
Expand All @@ -43,6 +44,7 @@
use craft\services\Volumes;
use craft\web\twig\variables\CraftVariable;
use craft\web\Controller;
use craft\web\UrlManager;

use markhuot\CraftQL\CraftQL;

Expand Down Expand Up @@ -228,6 +230,11 @@ protected function installEventHandlers()
$this->installElementEventHandlers();
$this->installMiscEventHandlers();
$this->installCraftQLEventHandlers();
$request = Craft::$app->getRequest();
// Install only for non-console site requests
if ($request->getIsSiteRequest() && !$request->getIsConsoleRequest()) {
$this->installSiteEventListeners();
}
}

/**
Expand Down Expand Up @@ -467,6 +474,42 @@ protected function installCraftQLEventHandlers()
}
}

/**
* Install site event listeners for site requests only
*/
protected function installSiteEventListeners()
{
// Handler: UrlManager::EVENT_REGISTER_SITE_URL_RULES
Event::on(
UrlManager::class,
UrlManager::EVENT_REGISTER_SITE_URL_RULES,
function (RegisterUrlRulesEvent $event) {
Craft::debug(
'UrlManager::EVENT_REGISTER_SITE_URL_RULES',
__METHOD__
);
// Register our AdminCP routes
$event->rules = array_merge(
$event->rules,
$this->customFrontendRoutes()
);
}
);
}

/**
* Return the custom frontend routes
*
* @return array
*/
protected function customFrontendRoutes(): array
{
return [
// Make webpack async bundle loading work out of published AssetBundles
'/cpresources/imageoptimize/<resourceType:{handle}>/<fileName>' => 'image-optimize/cp-nav/resource',
];
}

/**
* If the Field being saved is an OptimizedImages field, re-save the
* responsive image variants automatically
Expand Down
11 changes: 1 addition & 10 deletions src/assetbundles/imageoptimize/ImageOptimizeAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace nystudio107\imageoptimize\assetbundles\ImageOptimize;

use Craft;
use craft\web\AssetBundle;
use craft\web\assets\cp\CpAsset;

Expand All @@ -29,20 +28,12 @@ class ImageOptimizeAsset extends AssetBundle
*/
public function init()
{
$this->sourcePath = "@nystudio107/imageoptimize/assetbundles/imageoptimize/dist";
$this->sourcePath = '@nystudio107/imageoptimize/assetbundles/imageoptimize/dist';

$this->depends = [
CpAsset::class,
];

$this->js = [
'js/ImageOptimize.js',
];

$this->css = [
'css/ImageOptimize.css',
];

parent::init();
}
}
40 changes: 40 additions & 0 deletions src/assetbundles/imageoptimize/ImageOptimizeWelcomeAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* Image Optimize plugin for Craft CMS 3.x
*
* Automatically optimize images after they've been transformed
*
* @link https://nystudio107.com
* @copyright Copyright (c) 2017 nystudio107
*/

namespace nystudio107\imageoptimize\assetbundles\ImageOptimize;

use craft\web\AssetBundle;
use craft\web\assets\cp\CpAsset;

/**
* @author nystudio107
* @package ImageOptimize
* @since 1.2.0
*/
class ImageOptimizeWelcomeAsset extends AssetBundle
{
// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function init()
{
$this->sourcePath = '@nystudio107/imageoptimize/assetbundles/imageoptimize/dist';

$this->depends = [
CpAsset::class,
ImageOptimizeAsset::class,
];

parent::init();
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b1dea42

Please sign in to comment.