-
Notifications
You must be signed in to change notification settings - Fork 1
/
YiiQuaggaAsset.php
44 lines (39 loc) · 1.09 KB
/
YiiQuaggaAsset.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Asset bundle for Quagga Widget
*
* @package yii2-quaggaJS
* @author Jakob Reiter <jakob.reiter.io@gmail.com>
* @version 1.0
*/
namespace jakobreiter\quaggajs;
use Yii;
class YiiQuaggaAsset extends \yii\web\AssetBundle
{
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
];
public function init()
{
$this->sourcePath = '@vendor/jakobreiter/yii2-quagga-js';
$this->setupAssets('css', ['assets/quaggajs']);
$this->setupAssets('js', ['assets/quagga', 'assets/quagga_app']);
parent::init();
}
/**
* Set up CSS and JS asset arrays based on the base-file names
*
* @param string $type whether 'css' or 'js'
* @param array $files the list of 'css' or 'js' basefile names
*/
protected function setupAssets($type, $files = [])
{
foreach ($files as $file) {
$srcFiles[] = "{$file}.{$type}";
$minFiles[] = "{$file}.min.{$type}";
}
//$this->$type = YII_DEBUG ? $srcFiles : $minFiles;
$this->$type = $srcFiles;
}
}