<< Back to previous view

[CLJS-723] add :preamble option to compiler Created: 10/Dec/13  Updated: 17/Dec/13  Resolved: 17/Dec/13

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Travis Vachon Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: cljs

Attachments: Text File cljs_723.patch    

 Description   

Per this thread:

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

1) :preamble '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.



 Comments   
Comment by Travis Vachon [ 11/Dec/13 4:59 PM ]

patch to add :preamble

I'm not confident this is the best way to do the source map stuff - any thoughts/suggestions would be very welcome

Comment by Michael Bradley, Jr. [ 13/Dec/13 5:55 PM ]

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

With both :preamble and :postamble 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

Comment by David Nolen [ 14/Dec/13 2:37 PM ]

I'm fine with extending this to {:postamble}.

Comment by David Nolen [ 14/Dec/13 2:39 PM ]

fixed https://github.com/clojure/clojurescript/commit/454bcb70fbbd9e9feb20ada7b4043eab70dafea2

Comment by David Nolen [ 14/Dec/13 2:40 PM ]

Oops resolved wrong ticket

Comment by David Nolen [ 17/Dec/13 4: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.

Generated at Tue Sep 30 15:01:30 CDT 2014 using JIRA 4.4#649-r158309.