How to use script-assets?



  • I can use the #asset functionality for .css-files but for .js-files it doesn't find the file. There's error shown in the report generation. I'm using it in the same way as in the examples.

    Does it require some extra tricks to refer .js-files in a another .js-file?


  • administrators

    hi! it depends of the context where you reference the asset, can you share an example about how and where you reference the asset, the encoding param of the asset reference is very important in different contexts, maybe you need @encoding=string if you are referencing the asset in the context of a js code, but it will be much clear if you share an example



  • You can try this way.

    <style>
    {#asset /assets/my.css @encoding=utf8}
    </style>

    <script>
    {#asset /assets/my.js @encoding=utf8}
    </script>



  • Yes, that's the way I'm using. When importing some example to my server, everything works and also new files work if I clone them from the example. When I add new code file to the project without cloning, the #asset does not work at all. I don't know what is happening behind the scenes but I'll manage with this information though it's a "bit" strange.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.