We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
only
According to documentation I add $publishOptions['only'] in my project, but it doesn't work
$publishOptions['only']
class BootstrapAsset extends AssetBundle { public ?string $basePath = '@assets'; public ?string $baseUrl = '@assetsUrl'; public ?string $sourcePath = '@assetsPath/bootstrap'; public array $css = [ 'css/bootstrap.min.css', ]; public array $js = [ 'js/bootstrap.bundle.min.js', ]; public array $depends = [ \App\Assets\JqueryAsset::class, ]; public array $publishOptions = [ 'only' => [ 'css/bootstrap.min.css', 'js/bootstrap.bundle.min.js', ] ]; }
I expect to have only 2 files in published assets, but I have full bootstrap library like in
ea9e2702 - css - - bootstrap.min.css - js - - bootstrap.bundle.min.js
ea9e2702 - css - - bootstrap.css - - bootstrap.min.css - - bootstrap.rtl.css - - bootstrap-grid.css - - bootstrap-grid.rtl.css - - bootstrap-reboot.css - - bootstrap-reboot.rtl.css - - bootstrap-utilities.css - - bootstrap-utilities.rtl.css - js - - bootstrap.bundle.js - - bootstrap.bundle.min.js - - bootstrap.esm.js - - bootstrap.js
This code works like a charm, but it's not comfort and documentation have another way.
public function __construct() { $pathMatcher = new PathMatcher(); $filters = []; foreach ($this->css as $file) $filters[] = '**/' . $file; foreach ($this->js as $file) $filters[] = '**/' . $file; $this->publishOptions = [ 'filter' => $pathMatcher->only(...$filters), ]; }
The text was updated successfully, but these errors were encountered:
According to this link: https://github.com/yiisoft/assets/blob/master/docs/guide/en/asset-bundles.md
Sorry, something went wrong.
Instead only need to use filter option, that use PathMatcherInterface. Need to fix docs.
filter
PathMatcherInterface
No branches or pull requests
According to documentation I add
$publishOptions['only']
in my project, but it doesn't workWhat steps will reproduce the problem?
What is the expected result?
I expect to have only 2 files in published assets, but I have full bootstrap library like in
What do you get instead?
Workaround
This code works like a charm, but it's not comfort and documentation have another way.
Additional info
The text was updated successfully, but these errors were encountered: