Closed brainlock closed 10 years ago
This PR includes:
Sometimes we need to know which assets were generated by a given sacy block (for example to retrieve jsx components to pre-render on the server).
In this case the smarty template can call asset_compile like this:
{asset_compile block_ref="react-components"} <script type="text/x-jsx" src="/jslib/a_component.jsx"></script> ... {/asset_compile}
Sacy will assign the generated assets into $smarty.sacy.rendered_assets:
$smarty.sacy.rendered_assets
[ 'react-components' => [ // src relative to the document root ['type' => 'file', 'src' => '/assetcache/components-d141caabeb4e87ff2bd021da49e7305c-content.js'], ['type' => 'string', 'content' => '...rendered content...'], ], ... ]
We use this to fetch the sacy-compiled js when pre-rendering jsx-components on the server.
the reference thing is probably very much non-encouraged by Smarty itself, but as long as people don't use it, who cares? :p
This PR includes:
Sometimes we need to know which assets were generated by a given sacy block (for example to retrieve jsx components to pre-render on the server).
In this case the smarty template can call asset_compile like this:
Sacy will assign the generated assets into
$smarty.sacy.rendered_assets
:[ 'react-components' => [ // src relative to the document root ['type' => 'file', 'src' => '/assetcache/components-d141caabeb4e87ff2bd021da49e7305c-content.js'], ['type' => 'string', 'content' => '...rendered content...'], ], ... ]
We use this to fetch the sacy-compiled js when pre-rendering jsx-components on the server.