Here is what I use for Stardust.dev's JS:
    
    
    task clientr, "Build JS sources":
      exec "nimble js -d:client -d:js -d:danger --out:out/client.js client.nim"
      when defined(linux):
        # Little hack, replace {val: 0, has: false, val: 0, has: false}
        exec "sed -i 's/{val: 0, has: false, val: 0, has: false}/{val: 0, has: 
false}/g' out/client.js"
        exec "closure-compiler --js out/client.js --js_output_file 
out/client-compiled.js"
        # exec "uglifyjs out/client-compiled.js -o 
out/client-compiled-uglify.js -m toplevel"
        cpFile("out/client-compiled.js", "out/client.js")
        exec "sed -i \"s/REPLACEMEWITHTIMESTAMP/$(date +%s)/g\" out/index.html"
    
    
    Run

I used to use both closure-compiler and uglifyjs... and then uglifyjs straight 
up broke the JS. Closure-compiler is definitely the best though.

Hope it helps :)

Reply via email to