Let's say I want to combine a bunch of Javascript and Julius file. I do it like this:
jsWidget :: Widget
jsWidget = do
addScript $ StaticR js_test1_js
toWidget $(juliusFile "static/js/gis/sample.julius")
addScript $ StaticR js_test2_js
addScript $ StaticR js_test3_js
But the problem with the above approach is that Yesod takes all the Julius file in the widget and converts them to a single file (autogen-xxx.js) and appends it at the end. Although this is a good optimization, this breaks my JavaScript code. Is there a way to solve this problem ?
Unfortunately this cannot be done. This is the discussion that went on the mailing list regarding the problem.
In order to avoid this problem, I turned all the files into Javascript and added them using addScript. That maintains the correct order. The places where you have used variable interpolation in Julius files needs to be re-written using some other technique.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With