[英]Yii2 Assets Exclude Files, Directories on publishing
I want to publish some Asstes. 我想发布一些资产。 For example the animate.css donwloaded by bower or composer, but i dont want to copy not needed files into web asstes folder. 例如animate.css由bower或composer下载,但是我不想将不需要的文件复制到web asstes文件夹中。 i already use the the publish option, but some folders be copied anyway, but without content. 我已经使用了publish选项,但是无论如何仍会复制一些文件夹,但是没有内容。
the sourcefolder looks like this: 源文件夹看起来像这样:
/animate.css
./bower.json
./source
./source/bouncing_exits
./source/bouncing_exits/bounceOutLeft.css
./source/bouncing_exits/bounceOutDown.css
./source/bouncing_exits/bounceOutUp.css
./source/bouncing_exits/bounceOutRight.css
./source/bouncing_exits/bounceOut.css
./source/fading_exits
./source/fading_exits/fadeOutRight.css
./source/fading_exits/fadeOutLeft.css
./source/fading_exits/fadeOutDown.css
./source/fading_exits/fadeOutUp.css
./source/fading_exits/fadeOutLeftBig.css
./source/fading_exits/fadeOut.css
./source/fading_exits/fadeOutRightBig.css
./source/fading_exits/fadeOutDownBig.css
./source/fading_exits/fadeOutUpBig.css
./source/fading_entrances
./source/fading_entrances/fadeInRight.css
./source/fading_entrances/fadeInUp.css
... some more
./animate-config.json
./package.json
./gulpfile.js
./animate.min.css
./LICENSE
the asset bundle looks like this 资产捆绑看起来像这样
namespace frontend\assets;
use yii\web\AssetBundle;
/**
* Main frontend application asset bundle.
*/
class AnimateAsset extends AssetBundle
{
/**
* @inherit
*/
public $sourcePath = '@bower/animate.css';
/**
* @inherit
*/
public $css = [
'animate.min.css',
];
/**
* @inherit
*/
public $js = [
];
/**
* @inherit
*/
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
];
public $publishOptions = [
// 'forceCopy' => YII_DEBUG,
'only' => [
'animate.min.css',
],
'exept' => [
'source/*',
'source/',
'source',
],
];
}
and finaly the result in web asset folder looks like this 最后,Web资产文件夹中的结果如下所示
./source
./source/bouncing_exits
./source/fading_exits
./source/fading_entrances
./source/lightspeed
./source/zooming_entrances
./source/zooming_exits
./source/bouncing_entrances
./source/rotating_entrances
./source/attention_seekers
./source/sliding_exits
./source/rotating_exits
./source/flippers
./source/specials
./source/sliding_entrances
./animate.min.css
The empty folder still be copied?? 空文件夹仍要复制吗? How can I prevent this? 我该如何预防?
thx soju, that was a typo: thx soju,那是一个错字:
with that publish options below it works 与下面的发布选项一起工作
public $publishOptions = [
// 'forceCopy' => YII_DEBUG,
'only' => [
'animate.min.css',
],
'except' => [
'source',
],
];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.