From ae36a5cb0a48bc89442d50b6c3581f087427d05c Mon Sep 17 00:00:00 2001 From: dimti Date: Mon, 13 Sep 2021 17:15:33 +0300 Subject: [PATCH] Initial commit --- .gitignore | 1 + Plugin.php | 96 ++++++++++++++++++++++++++++++++++++++++++++++ classes/ManifestReader.php | 16 ++++++++ composer.json | 22 +++++++++++ updates/version.yaml | 1 + 5 files changed, 136 insertions(+) create mode 100644 .gitignore create mode 100644 Plugin.php create mode 100644 classes/ManifestReader.php create mode 100644 composer.json create mode 100644 updates/version.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a09c56d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea diff --git a/Plugin.php b/Plugin.php new file mode 100644 index 0000000..b17f203 --- /dev/null +++ b/Plugin.php @@ -0,0 +1,96 @@ + 'assetsmanifest', + 'description' => 'No description provided yet...', + 'author' => 'wpstudio', + 'icon' => 'icon-leaf' + ]; + } + + /** + * Register method, called when the plugin is first registered. + * + * @return void + */ + public function register() + { + + } + + /** + * Boot method, called right before the request route. + * + * @return array + */ + public function boot() + { + + } + + /** + * Registers any front-end components implemented in this plugin. + * + * @return array + */ + public function registerComponents() + { + return []; // Remove this line to activate + + return [ + 'Wpstudio\Assetsmanifest\Components\MyComponent' => 'myComponent', + ]; + } + + /** + * Registers any back-end permissions used by this plugin. + * + * @return array + */ + public function registerPermissions() + { + return []; // Remove this line to activate + + return [ + 'wpstudio.assetsmanifest.some_permission' => [ + 'tab' => 'assetsmanifest', + 'label' => 'Some permission' + ], + ]; + } + + /** + * Registers back-end navigation items for this plugin. + * + * @return array + */ + public function registerNavigation() + { + return []; // Remove this line to activate + + return [ + 'assetsmanifest' => [ + 'label' => 'assetsmanifest', + 'url' => Backend::url('wpstudio/assetsmanifest/mycontroller'), + 'icon' => 'icon-leaf', + 'permissions' => ['wpstudio.assetsmanifest.*'], + 'order' => 500, + ], + ]; + } +} diff --git a/classes/ManifestReader.php b/classes/ManifestReader.php new file mode 100644 index 0000000..a40d6cb --- /dev/null +++ b/classes/ManifestReader.php @@ -0,0 +1,16 @@ +manifest = json_decode(file_get_contents($manifestPath)); + } + + public function get($assetName) + { + return $this->manifest->$assetName; + } +} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..83d8ea6 --- /dev/null +++ b/composer.json @@ -0,0 +1,22 @@ +{ + "name": "wpstudio/assetsmanifest-plugin", + "type": "october-plugin", + "description": "Extract full paths to assets files from manifest.json", + "require": { + "composer/installers": "~1.0" + }, + "keywords": [ + "manifest", + "json", + "webpack", + "assets", + "hash" + ], + "license": "MIT", + "authors": [ + { + "name": "WP Studio Team", + "email": "info@wpstudio.ru" + } + ] +} diff --git a/updates/version.yaml b/updates/version.yaml new file mode 100644 index 0000000..58413d6 --- /dev/null +++ b/updates/version.yaml @@ -0,0 +1 @@ +1.0.1: First version of assetsmanifest