Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Yii2资产不包括发布时的文件、目录_Php_Yii2_Assets - Fatal编程技术网

Php Yii2资产不包括发布时的文件、目录

Php Yii2资产不包括发布时的文件、目录,php,yii2,assets,Php,Yii2,Assets,我想发表一些屁话。例如,animate.css由bower或composer加载,但我不想将不需要的文件复制到web asstes文件夹中。 我已经使用了“发布”选项,但仍可以复制某些文件夹,但不复制内容 sourcefolder如下所示: /animate.css ./bower.json ./source ./source/bouncing_exits ./source/bouncing_exits/bounceOutLeft.css ./source/bouncing_exits/boun

我想发表一些屁话。例如,animate.css由bower或composer加载,但我不想将不需要的文件复制到web asstes文件夹中。 我已经使用了“发布”选项,但仍可以复制某些文件夹,但不复制内容

sourcefolder如下所示:

/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
资产包如下所示

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',
        ],
    ];
}
./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
最后,web资产文件夹中的结果如下所示

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',
        ],
    ];
}
./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
是否仍要复制空文件夹??
我怎样才能防止这种情况发生?

thx soju,这是一个打字错误:

使用下面的发布选项,它可以工作

public $publishOptions = [
//        'forceCopy' => YII_DEBUG,
        'only' => [
            'animate.min.css',
        ],
        'except' => [
            'source',
        ],
    ];

你应该简单地尝试
except
而不是
except
thx!!效果非常好;)