This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-10
Channels
- # beginners (97)
- # boot (77)
- # cider (7)
- # cljs-dev (47)
- # cljsrn (3)
- # clojure (125)
- # clojure-austin (5)
- # clojure-dusseldorf (1)
- # clojure-italy (4)
- # clojure-russia (91)
- # clojure-spec (80)
- # clojure-uk (54)
- # clojurescript (92)
- # core-async (6)
- # cursive (17)
- # datomic (56)
- # hoplon (7)
- # immutant (3)
- # liberator (3)
- # luminus (4)
- # off-topic (26)
- # om (41)
- # om-next (11)
- # pedestal (3)
- # perun (3)
- # protorepl (25)
- # re-frame (32)
- # reagent (33)
- # ring (46)
- # rum (3)
- # spacemacs (5)
- # specter (82)
- # test-check (16)
- # untangled (8)
- # yada (26)
@michael.heuberger woudl you not do this in the client?
rather meant a recipe @micha
compiler options, modules, cljsjs packages, something along these components, not sure here
@michael.heuberger usually i think you include all the polyfills, and they just are no-op when the feature is supported in the browser natively?
what if i dont want to load them at all unless it’s i.E. IE11?
this to reduce page load and risks
goog.userAgent
can come in handy - just haven’t figured out to dynamically load i.E. babel-polyfill or so
yeah they do
it’s just a special case we’re having here and wonder if there is a recipe for that
how can we dynamically load another cljsjs package?
dont want to solve this on the html layer
but what src to use?
for example we have an entry [cljsjs/babel-polyfill "6.20.0-1”]
in our build.boot … how can i dynamically load it in the app code?
i ll try this with goog.globalEval = function(script) {…
or maybe goog.net.jsloader.load = function(uri, opt_options) {
is better? i dont know
@micha dont have a jar here … is there another way to figure out the path?
if you have the cljsjs package as a dependency you would have the jar, you can do boot uber show -f
doing a PR for babel-polyfill here
… that command boot uber show -f
categorises them in common, development and production. can this be automated which one to pick?
boot -BPd cljsjs/async:2.0.0-rc.4-0 sift -j 'cljsjs/async:development/.*\.inc\.js$' show -f
ok, so for example i have this
~/c/ui ❯❯❯ boot -BPd cljsjs/babel-polyfill:6.20.0-1 uber show -f
Adding uberjar entries...
├── deps.cljs
├── cljsjs
│ └── babel-polyfill
│ ├── common
│ │ └── babel-polyfill.ext.js
│ ├── development
│ │ └── polyfill.inc.js
│ └── production
│ └── polyfill.min.inc.js
└── META-INF
└── maven
└── cljsjs
└── babel-polyfill
├── pom.properties
└── pom.xml
and then have this in the app code after an if block
(goog.net.jsloader/load “cljsjs/babel-polyfill/production/polyfill.min.inc.js”)))))
is this looking good to you @micha?
doesnt look like it has to be, see https://developer.pubref.org/static/apidoc/global/closure/goog/net/jsloader/load.html
looks like it is working here
many thanks 🙂
will do some tests now
ok, will keep that in mind
The previous issue is a blocking problem for us. Any help on where to look for the cause or ways to efficiently debug this is welcome.
what am I doing incorreclty here? I’m getting a null pointer so it’s pretty hard to debug:
(set-env!
:resource-paths #{”src”}
...
(deftask tdd
"Launch a test environment, and visit localhost:9003/test.html. Note this
does not publish the library locally, and is only for testing purposes."
[]
(comp
(set-env! :source-paths #(conj % "test"))
(set-env! :resource-paths #(conj % "resources"))
(serve :dir "target"
:port 9003)
(watch)
(reload :on-jsload 'aft.testing-util.runner/rerun)
(cljs)
(target :dir #{"target"})))
What I want to do is completely change the :source-paths and :resource-paths when running in a test environment. My boot process should normally emit code for others to consume, and therefore my “src” is emitted as a resource. However, when I’m testing, I don’t really want to emit anything, and want to use a more normal “source-paths is src/…” and “resources include things like test.html"
I have a resources/test.html
that includes test setup / teardown, for example… but I dont want it to be a resource because consumers of my lib shouldn’t get some random testing html in their build after including my lib
try
(set-env! :source-paths #(conj % "test"))
(set-env! :resource-paths #(conj % "resources"))
outside / above comp
@lwhorton the nullpointer exception is because comp
doesn't like nil functions e.g: ((comp nil identity) 1)
. I think your problem can be solved with sift
if I understand correctly: when generating a jar / uberjar, code should be generated and when testing test-resources should be used, which should not be included in the generated jar / uberjar.
it was a question not a suggestion (should have been a question mark at the end ...) 🙂 Glad it worked!
if someone has a moment ... i want to some something like lein install
to install a clojure lib locally .. how can i do that with boot ?
@clojuregeek boot has a built-in install
task for that
ok cool 🙂 thanks