How to include JS and CSS resources for a plugin variable I've got a variable (widget is a better word) that I want to output with accompanying CSS and/or JS. 

I'm rendering the variable (widget) with the following

return TemplateHelper::getRaw($output);


I realize the following exists but other than inline js/css is there a way to output the widget and include CSS/JS by only using a single variable? I want to make this as simple as possible.

&lt;script src="{{ resourceUrl('plugin/js/public.js') }}"&gt;&lt;/script&gt;


`
You can use these and Craft automatically adds the files in the appropriate spots.

$output = craft()-&gt;templates-&gt;includeJsFile(UrlHelper::getResourceUrl('plugin/script.js'));

$output .= craft()-&gt;templates-&gt;includeCssResource(UrlHelper::getResourceUrl('plugin/styles.css'));