Ability to convert a Resource from Resources pipe line back to string


The scenario: I have a js resource which I need to minify and print directly inside template. Is this possible? Something like the below:

{{ $stringified_js = (resources.Get "JSFileName" | minify).ToString }}

Converting a resource to string or being able to print a resource is what I’m looking for.

Thank you

Yes, you can.

{{ $stringified_js := resources.Get "JSFileName" | minify  }}

{{ $stringified_js.Content | safeJS }}

Thank you so much @pamubay :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.