yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

AssetsBunled $publishOptions No Works. #8785

Open tecnologiaterabyte opened 9 years ago

tecnologiaterabyte commented 9 years ago

Hi, my composer:

"require": {
    "php": ">=5.4.0",
    "yiisoft/yii2": "dev-master",
    "yiisoft/yii2-bootstrap": "dev-master",
    "yiisoft/yii2-swiftmailer": "dev-master"
},

My Example Assets:

<?php

namespace terabyte\adminlte\assets\themes\AdminLTE;

use yii\web\AssetBundle;

class FontAwesomeAsset extends AssetBundle
{
    public $sourcePath = '@bower/font-awesome';
    public $css = [
        'css/font-awesome.min.css',
    ];
    public $publishOptions = [
        'only' => [
            'fonts/',
            'css/',
        ]
    ];
}

Debug Assets:

debug_asset

Problem:

1.- Copy all subdirectory:

directory

2.- Copy empty subdirectories:

directory_empty

cebe commented 9 years ago

have you tried it with a wildcard *?

    public $publishOptions = [
        'only' => [
            'fonts/*',
            'css/*',
        ]
    ];
tecnologiaterabyte commented 9 years ago

works part, correctly published the requested subdirectories, but also all the empty subdirectory.

Create Subdirectory css y fonts Asset Publish Correct.

Error:

Create subdirectory less y scss unsolicited.

Thks,

tecnologiaterabyte commented 9 years ago

@cebe work fine with except option, please update docs.

namespace cjtterabytesoft\adminlte\basic\assets\bower;

use yii\web\AssetBundle;

class FontAwesomeAsset extends AssetBundle
{
    public $sourcePath = '@vendor/bower/font-awesome/';

    public $css = [
        'css/font-awesome.css',
    ];

    public $publishOptions = [
        'only' => [
            'fonts/*',
            'css/*',
        ],
        'except' => [
            'less',
            'scss',
        ]
    ];
}
Skysplit commented 9 years ago

publishOptions does not work for me neither

class SemanticAsset extends \yii\web\AssetBundle
{

    public $sourcePath = '@bower/semantic-ui/dist/';
    public $css = [
        'semantic.min.css',
    ];
    public $js = [
        'semantic.min.js'
    ];
    public $publishOptions = [
        'except' => [
            'components/'
        ]
    ];

}

Yet the components directory is being published (Windows)