Closed dgvirtual closed 2 months ago
I think that's a good idea. I'm trying to think if there's any other attributes that would be worth adding and drawing a blank. But if there are then maybe accepting an array of key value pairs that would be attributes on the asset would be even better.
@lonnieezell, I see that you have already implemented some changes, but I would like to submit the functionality we were talking about above.
My idea after your suggestions was to have an additional argument $attributes
function asset_link(string $location, string $type, mixed $attributes = null): string
If a string was passed, the helper would render the string as if it were an attribute without value, like async
or defer
, and if an array was passed, it would render all elements as attribute key="value" pairs.
So, here is my PR: #418.
Feel free to overwrite my changes. They didn't do what I expected them to and were added very recently so I wouldn't expect too much usage. I'll look at the PR tonight, hopefully.
Hi @lonnieezell, could you look at this and other PR's, there are 5 or so, I would appreciate it.
Would a PR with added "defer" attribute for js type assets be acceptable? Say, a third argument on asset_link() (bool; true would add 'defer', false would be default; or string; 'defer' or 'async', defaulting to false)? If the idea is approved, I would submit a PR.