Skip to content

Commit

Permalink
WebAsset more assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Sep 27, 2018
1 parent ebd0ef8 commit 2602592
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 2 deletions.
8 changes: 7 additions & 1 deletion build/build-modules-js/settings.json
Expand Up @@ -370,7 +370,13 @@
"dist/css-vars-ponyfill.js": "js/css-vars-ponyfill.js",
"dist/css-vars-ponyfill.min.js": "js/css-vars-ponyfill.min.js",
"dist/css-vars-ponyfill.min.js.map": "js/css-vars-ponyfill.min.js.map"
}
},
"provideAssets": [
{
"name": null,
"js": ["css-vars-ponyfill.min.js"]
}
]
},
"chosen-js": {
"name": "chosen",
Expand Down
18 changes: 18 additions & 0 deletions build/media/legacy/joomla.asset.json
@@ -0,0 +1,18 @@
{
"name": "joomla",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0+",
"assets": {
"bootstrap-init": {
"name": "bootstrap-init",
"dependencies": [
"core",
"bootstrap.js"
],
"js": [
"legacy/bootstrap-init.min.js"
]
}
}
}
50 changes: 50 additions & 0 deletions build/media_src/system/joomla.asset.json
@@ -0,0 +1,50 @@
{
"name": "joomla",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0+",
"assets": {
"core": {
"name": "core",
"js": [
"system/core.min.js"
]
},
"keepalive": {
"name": "keepalive",
"dependencies": [
"core"
],
"js": [
"system/keepalive.min.js"
]
},
"multiselect": {
"name": "multiselect",
"dependencies": [
"core"
],
"js": [
"system/multiselect.min.js"
]
},
"searchtools": {
"name": "searchtools",
"dependencies": [
"core"
],
"js": [
"system/searchtools.min.js"
]
},
"showon": {
"name": "showon",
"dependencies": [
"core"
],
"js": [
"system/showon.min.js"
]
}
}
}
24 changes: 23 additions & 1 deletion libraries/src/WebAsset/WebAssetRegistry.php
Expand Up @@ -347,7 +347,7 @@ public function attach(Document $doc)

unset($attr['__pathOrigin'], $attr['__isExternal']);

$doc->addScript($path, ['version' => $version], $attr);
$doc->addStyleSheet($path, ['version' => $version], $attr);
}

// Add Scripts of the asset
Expand Down Expand Up @@ -600,4 +600,26 @@ protected function parseRegistryFile($path)
$this->addAsset($assetItem);
}
}

/**
* Dump available assets to simple array, with some basic info
*
* @return @array
*
* @since __DEPLOY_VERSION__
*/
public function debugAssets()
{
$assets = $this->assets;
$result = [];

foreach ($assets as $asset) {
$result[$asset->getName()] = [
'deps' => implode(', ', $asset->getDependencies()),
'state' => $asset->getState(),
];
}

return $result;
}
}

0 comments on commit 2602592

Please sign in to comment.