forked from nirvana-msu/yii2-infinite-scroll
/
InfiniteScrollAsset.php
39 lines (34 loc) · 1.01 KB
/
InfiniteScrollAsset.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
<?php
/**
* @link https://github.com/dlds/yii2-infinite-scroll
* @copyright Copyright (c) 2014 Alexander Stepanov
* @license MIT
*/
namespace dlds\infinitescroll;
use Yii;
use yii\web\AssetBundle;
/**
* @author Alexander Stepanov <student_vmk@mail.ru>
*/
class InfiniteScrollAsset extends AssetBundle
{
public $sourcePath = '@bower/jquery-infinite-scroll';
public $css = [
];
public $js = [ // Configured conditionally (source/minified) during init()
];
public $depends = [
'yii\web\JqueryAsset',
];
public function init()
{
parent::init();
$this->js[] = YII_DEBUG ? 'jquery.infinitescroll.js' : 'jquery.infinitescroll.min.js';
$this->publishOptions['beforeCopy'] = function ($from) {
$path = str_replace(realpath(Yii::getAlias('@bower') . '\jquery-infinite-scroll'), '', $from);
return
$path !== DIRECTORY_SEPARATOR.'site'
&& $path !== DIRECTORY_SEPARATOR.'wordpress-plugin';
};
}
}