emezeske / lein-cljsbuild

Leiningen plugin to make ClojureScript development easy.
Other
1.1k stars 151 forks source link

Discussion: Using edn file for Closure-defines or cljs-build configuration #478

Open lxsameer opened 7 years ago

lxsameer commented 7 years ago

Hi. In several different projects I had to use some sort of a build configuration for my cljs app to build it conditionally based on some data defined using closure-defines . But growth or this data caused a mess in my project.clj file and made my life hard.

I was thinking about adding a functionality to cljs-build plugin to support external configuration files. Either for all cljs-build configuration or just for closure-defines. So simply a configuration key with a file name or path as the value. The file should be in edn format and cljs-build should use the data inside that file and inject it to the built bundle.

I wanted to discuss this here before jumping in and implement the feature. What do you think folks? There is a good chance that I miss something and there are a solution for this problem before.

danielcompton commented 7 years ago

Lein allows you to define and merge profiles, which seems like it would solve this problem, at least partially?

lxsameer commented 7 years ago

Yeah somehow. But the problem I'm having is about writing a library which need it's configuration in a file. So expecting my user to copy paste some code in his/her project.clj might not be as simple as having a file just one entry like :configuration-file :foo/bar. It would makes the library author easier. Also I didn't mean clj build profiles. I mean cljs-build build profiles.