Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yesod: Maintaining order of JavaScript and Julius Files

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 ?

like image 898
Sibi Avatar asked Oct 02 '22 20:10

Sibi


1 Answers

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.

like image 128
Sibi Avatar answered Oct 13 '22 09:10

Sibi