Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Nov 12, 2021
1 parent 02b27b4 commit 9209bba
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 48 deletions.
51 changes: 3 additions & 48 deletions src/assets/BaseAsset.php
Expand Up @@ -8,65 +8,20 @@
* @date 24.01.2015
* @since 1.0.0
*/

namespace skeeks\sx\assets;

use skeeks\sx\File;
use yii\web\AssetBundle;

/**
* Class BaseAsset
* @package skeeks\sx\assets
*/
abstract class BaseAsset extends AssetBundle
class BaseAsset extends \skeeks\cms\base\AssetBundle
{
public $sourcePath = '@skeeks/sx/assets';
public $css = [];
public $js = [];
public $depends = [];

/*public function init()
{
parent::init();
$this->js = (array) $this->js;
if (count($this->js) <= 1)
{
return;
}
$fileName = 'yii2-sx-' . md5($this->className()) . ".js";
$fileMinJs = \Yii::getAlias('@app/runtime/assets/js/' . $fileName);
if (file_exists($fileMinJs))
{
$this->js = [
$fileName
];
$this->sourcePath = '@app/runtime/assets/js';
return;
}
$fileContent = "";
foreach ($this->js as $js)
{
$fileContent .= file_get_contents($this->sourcePath . '/' . $js);
}
if ($fileContent)
{
$file = new File($fileMinJs);
$file->make($fileContent);
}
}*/

/**
* @param string $asset
* @return string
* @throws \yii\base\InvalidConfigException
*/
static public function getAssetUrl($asset)
{
return \Yii::$app->assetManager->getAssetUrl(\Yii::$app->assetManager->getBundle(static::className()), $asset);
}
}
7 changes: 7 additions & 0 deletions src/assets/Core.php
Expand Up @@ -10,13 +10,20 @@
*/
namespace skeeks\sx\assets;

use skeeks\sx\File;
use yii\helpers\Json;
/**
* Class Core
* @package skeeks\sx\assets
*/
class Core extends BaseAsset
{
public function init()
{
parent::init();
$this->_implodeFiles();
}

/**
* Registers this asset bundle with a view.
* @param View $view the view to be registered with
Expand Down
6 changes: 6 additions & 0 deletions src/assets/Custom.php
Expand Up @@ -15,6 +15,12 @@
*/
class Custom extends BaseAsset
{
public function init()
{
parent::init();
$this->_implodeFiles();
}

public $js = [
'js/Widget.js',
'js/helpers/Helpers.js',
Expand Down

0 comments on commit 9209bba

Please sign in to comment.