-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify configuration #25
Comments
Yeah, I agree there's some configuration overload going on. I'm waffling on cemerick/clojurescript.test#20, and anything similar here; given my involvement of all of these projects (clojurescript.test, cljx, cljsbuild), I think I'm very susceptible to some myopia w.r.t. how they're used. I want them to be generally useful, and baking in "useful defaults" among the three (or more?) may lead to unintended mingling of concerns. I'm leaning towards putting all cross-cutting configuration defaults/helpers into a separate "easy-cljs" middleware that encapsulates one way of using all of the projects together. I have something like this I use privately, and may just tweak that and put it out there. FWIW, I always keep my Clojure, ClojureScript, and cljx files in separate directories under Thoughts welcome, per usual… |
Right having a dedicated middleware makes complete sense and does not add coupling between those project. Any specific reason why you keep your files in separate directories? |
On Oct 19, 2013, at 5:37 PM, Julien Eluard [email protected] wrote:
|
Ah right in this case it makes sense! I also have the scenario where I have a portable library with a few namespaces so different that I keep them as separate clj/cljs files. I was wondering if this could introduce some unintended effects (like incorrect jar packaging?). |
On Oct 19, 2013, at 5:55 PM, Julien Eluard [email protected] wrote:
mimmo |
I end up with something like this: :cljx {:builds [{:source-paths ["app/cljx"]
:output-path "app/generated/clj/samedhi/quizry"
:rules :clj}
{:source-paths ["app/cljx"]
:output-path "app/generated/cljs/samedhi/quizry"
:rules :cljs}
{:source-paths ["app/macro-cljx"]
:output-path "app/generated/clj/samedhi/quizry"
:rules
{:filetype "clj"
:features #{"clj"}
:transforms []}}
{:source-paths ["app/macro-cljx"]
:output-path "app/generated/cljs/samedhi/quizry"
:rules
{:filetype "clj"
:features #{"cljs"}
:transforms []}}]} I do this because I have macros that need to reference different ns if they are in clj or cljs; however, since they are macros, they need to output as .clj files for both clj (of course) AND cljs. Just wanted to put my two cents in in case people were wondering what other peoples :cljx looked like. Of course, there may be a much better way to do this, and I would be happy to hear about it if anyone has any better ideas. |
Chas taught me to use target dir for the generated stuff. This way when you issue the Regarding the :feature trick for the macro I need to think about it. It seems to be smart. mimmo On Oct 24, 2013, at 12:01 AM, Stephen Cagle [email protected] wrote:
|
Just in case you didn't know, you can also use something like :clean-targets [:target-path "app/generated"] to tell lein what directories you want removed on "lein clean" Yeah, maybe it is a bit too "smart". My biggest issue with it is that I have two files with the same name, namespace, and that both end in clj. Somehow I end up always loading the #+clj version macro namespaces, so when I am compiling clojurescript code, I have to open up the #+cljs derived macro files and compile them manually before I build the .cljs files that depend on them. So, yeah, it works, but it is a bit of a mess. |
At the moment the best way I found to not to be overwhelmed from all this very boring and fragile configuration has been to define lein-templates. As soon as I'll test them better I'll published. At the moment I defined a lein-template for any pure CLJS lib in which I injected:
I also kept separated all the development and testing stuff in the :dev profile of the profiles.clj local to the project. there should be much better way to simplify all this stuff. |
Trimming the scope of 0.5.0 so as to cut a release addressing pressing issues. Will circle back later. |
Most of my projects using cljx end up with a configuration similar to:
Note that the
cljx
configuration has some implications onsource-paths
,test-paths
andcljsbuild
.Most of it could be deduced and injected at run time (by a leiningen plugin). The configuration could be simplified down to:
This is similar to this proposition for
clojurescript.test
.The whole configuration could be omitted with some default:
source-paths
is the concatenation ofsource-paths
andtest-paths
output-path
has some defaultrules
defaults to[:clj :cljs]
Now this is probably too much (and assumes
cljx
files are in the same directory structures thanclj
files, which I usually do).The text was updated successfully, but these errors were encountered: