Graham MacDonald
Graham MacDonald

Reputation: 397

How do I get Clojure to load a project-specific .clj file on REPL launch?

How do I get Clojure to load a project-specific .clj file on repl launch? I want to have some function available to me whenever I open up a new repl (I'm using nREPL on emacs, for what it's worth...)

Thanks

Upvotes: 4

Views: 916

Answers (1)

i-blis
i-blis

Reputation: 3179

Add an entry to your project.clj's :repl-options like the following

:repl-options {:init (load-file "src/your-project-specific-file.clj") }

If you'd like your functions to be available in all your REPLs, add an entry the user profile in .lein/profiles.clj as follows:

{
 :user
  {:repl-options {:init (load-file "path/to/file.clj")}}
}

Upvotes: 6

Related Questions