MCPcopy
hub / github.com/pyload/pyload / compile_js

Function compile_js

pavement.py:187–200  ·  view source on GitHub ↗

Compile .coffee files to javascript

()

Source from the content-addressed store, hash-verified

185
186@task
187def compile_js():
188 """ Compile .coffee files to javascript"""
189
190 root = path("module") / "web" / "media" / "js"
191 for f in root.glob("*.coffee"):
192 print "generate", f
193 coffee = Popen(["coffee", "-cbs"], stdin=open(f, "rb"), stdout=PIPE)
194 yui = Popen(["yuicompressor", "--type", "js"], stdin=coffee.stdout, stdout=PIPE)
195 coffee.stdout.close()
196 content = yui.communicate()[0]
197 with open(root / f.name.replace(".coffee", ".js"), "wb") as js:
198 js.write("{% autoescape true %}\n")
199 js.write(content)
200 js.write("\n{% endautoescape %}")
201
202
203@task

Callers

nothing calls this directly

Calls 6

pathFunction · 0.85
PopenClass · 0.85
communicateMethod · 0.80
closeMethod · 0.45
replaceMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected