add :preamble option to compiler

Description

Per this thread:

https://groups.google.com/forum/#!searchin/clojurescript/preamble/clojurescript/rUIlLfcYZvE/Yskfh4znL_0J

1) reamble 's value will be a vector of paths
2) the compiled output is prepended with the contents of the files at those paths
3) the generated source map points to the correct/adjusted line numbers

Additionally, when compiling for the :nodejs target the preamble contents will default to the hashbang we currently write in that situation.

Environment

None

Activity

Show:
Michael Bradley
December 13, 2013, 11:55 PM

Could the issue (and patch) be expanded to also support a ostamble option?

With both reamble and ostamble options available, it would be easy to implement more sophisticated compiler-output wrappers, such as the one used by David Nolen's mori library (which I helped adapt from the Q javascript library).

See: https://github.com/swannodette/mori/blob/master/support/wrapper.js

David Nolen
December 14, 2013, 8:37 PM

I'm fine with extending this to {ostamble}.

David Nolen
December 14, 2013, 8:39 PM
David Nolen
December 14, 2013, 8:40 PM

Oops resolved wrong ticket

David Nolen
December 17, 2013, 10:26 PM

fixed, https://github.com/clojure/clojurescript/commit/136bf46c656265a93dd15c40925f11edb34bd127.

If someone wants to open a postamble ticket and attach a patch go for it.

Completed

Assignee

Unassigned

Reporter

Travis Vachon

Labels

Approval

None

Patch

None

Priority

Minor