Comments (6)
This may involve classpath scanning to find out the .cljs files from CLASSPATH. These pointers may be useful:
http://code.google.com/p/reflections/
from lein-cljsbuild.
What is the use case for this? Typically I would expect that if a CLJS file was not in the :source-path tree, it would be referred to by something that is, via a ns
form, which as far as I know works just fine.
This would be a not-insignificant amount of work to implement, as cljs.closure/build
expects a directory name. An alternate build function would have to be created to support compiling an arbitrary set of files instead of just the files in a directory. Another difficulty is that the CLJS files in JARs would have to be specified one-by-one, because there is no way to list a directory in a JAR file.
from lein-cljsbuild.
What do you mean by "..it would be referred to by something that is, via a ns
form, which as far as I know works just fine." I am not sure I understood what you meant by that.
A use-case would be distributing CLJS library in source form via Maven infrastructure (e.g. Clojars) so that others can extend the code.
I understand the work would be non-trivial. I realized reusable CLJS code must be distributed in source form, which could be JAR or ZIP. When we distribute CLJS code in source form via JAR/ZIP files via Maven infrastructure, it's very important to support loading them from CLASSPATH as source files.
I also realized it's possible to scan the CLASSPATH when the top-level package or directory name is supplied. Should we support this, we may need to provide for a key in project.clj
under :cljsbuild ==> :builds ==> :source-namespaces
that points to a vector of top-level namespaces that should be scanned for .cljs
files. All of those .cljs
files and those from :source-path
should be copied to a common directory before they can be compiled, because the CLJS compiler picks up source files from a filesystem directory.
from lein-cljsbuild.
It is already possible to distribute CLJS code inside a JAR, and to refer to that code from a dependent project. As long as the CLJS source files are included in the JAR, and that JAR is on the classpath, you can :require
or :use
them. For instance, the jayq [1] library has some CLJS files in its src/
dir, which is included in the JAR file. In my project, I added a dependency on [jayq "0.1.0-SNAPSHOT"]
. Then, in one of my CLJS files in my :source-path
, I have (ns (:require [jayq.core :as jayq]))
and I can access the namespace just fine.
It seems to me that this is sufficient for sharing CLJS code between projects. Am I missing something?
[1] https://github.com/ibdknox/jayq
from lein-cljsbuild.
I can also confirm that this already works and works well :)
from lein-cljsbuild.
I'm closing this because I think it is not needed. Feel free to reopen it with a detailed description if I am wrong.
from lein-cljsbuild.
Related Issues (20)
- Custom tagged literals cause build failure HOT 1
- Fails on Java 9? HOT 2
- :asset-path isn't documented HOT 1
- Circular dependencies : Warn user when a namespace requires itself HOT 2
- Adding 'monger' dependency breaks cljsbuild. HOT 2
- Possibility to add cli options to closure compiler. HOT 2
- reload-clojure causes compilation failure in portable projects HOT 4
- Could not write JavaScript nil HOT 1
- Exception (...)/objectutil.js is not a relative path HOT 7
- Consider exposing :watch-fn compiler option? HOT 1
- :prep-tasks dont work when running `lein cljsbuild ...`
- Miraculously disappearing dependencies when using lein cljsbuild auto. HOT 2
- warning-handlers: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn HOT 2
- Duplicate input error HOT 1
- Recompiling compiled app with different optimization type
- Simple example project does not compile HOT 1
- `lein trampoline cljsbuild repl-rhino` fails with jdk 11 HOT 1
- cljsbuild-example-simple didnt run with lein 2.9.5 and Java version > 11 & 15 HOT 1
- cljsbuild cannot find reagent HOT 1
- Fails with ClojureScript newer than 1.10.764 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lein-cljsbuild.