Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/.idea
|
96
Plugin.php
Normal file
96
Plugin.php
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?php namespace Wpstudio\AssetsManifest;
|
||||||
|
|
||||||
|
use Backend;
|
||||||
|
use System\Classes\PluginBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* assetsmanifest Plugin Information File
|
||||||
|
*/
|
||||||
|
class Plugin extends PluginBase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns information about this plugin.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function pluginDetails()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => '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,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
16
classes/ManifestReader.php
Normal file
16
classes/ManifestReader.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php namespace Wpstudio\AssetsManifest\Classes;
|
||||||
|
|
||||||
|
class ManifestReader
|
||||||
|
{
|
||||||
|
private $manifest = null;
|
||||||
|
|
||||||
|
public function __construct(string $manifestPath)
|
||||||
|
{
|
||||||
|
$this->manifest = json_decode(file_get_contents($manifestPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($assetName)
|
||||||
|
{
|
||||||
|
return $this->manifest->$assetName;
|
||||||
|
}
|
||||||
|
}
|
22
composer.json
Normal file
22
composer.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1
updates/version.yaml
Normal file
1
updates/version.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.0.1: First version of assetsmanifest
|
Reference in New Issue
Block a user