You can however just send the path string to your partial and use the
@asset directive in your partial.
I'm using the Wordpress framework Sage and it comes bundled with Blade templating. Sage has a custom directive called
@asset which returns an asset URL. For example
I want to use that directive inside of an
@include. Is it possible?
Example, I'd expect this to work but it returns an error saying that
@asset is an undefined function, but it works fine outside of the
@include('partials/components/hero', ['data' => [ 'heading' => 'Hero heading example from pattern library', 'subtitle_1' => 'Hero subtitle example from pattern library', 'subtitle_2' => 'Hero subtitle example from pattern library', 'show_illustration' => true, 'illustration_src' => @asset('images/illustrations/1. ]])
2条回答 默认 最新
- 已采纳 douluyezhen4512 2018-06-13 14:47
You cannot.点赞 评论 复制链接分享
- donglei_0507 2018-06-13 14:50
You should be able to use the
asset()helper function instead or pass the string directly to the path of your asset.
Note: Based on the code you have shown (
@asset('images/illustrations/1.) that is incorrect syntax. It is missing the closing quote and bracket.点赞 评论 复制链接分享