1
Yii2應用程序將js文件移至前端/資產中的AppAsset.php文件。但是,@bower
不會解析爲別名。yii2 @bower無法從資產捆綁文件中解析
namespace frontend\assets;
use yii\web\AssetBundle;
/**
* @author Qiang Xue <[email protected]>
* @since 2.0
*/
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
];
public $js = [
'js/script.js',
'@bower/angular/angular.min.js',
'@bower/angular-ui-router/release/angular-ui-router.min.js',
'@bower/angular-bootstrap/ui-bootstrap.min.js'
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\web\JQueryAsset',
];
}
瀏覽器上http://localhost.lq/@bower/angular/angular.min.js
'@ bower'定義在[源代碼](https://github.com/yiisoft/yii2/blob/master/framework/base/Application.php#L456) – cnvzmxcvmcx 2015-04-05 05:45:25