This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-05
Channels
- # bangalore-clj (1)
- # beginners (99)
- # boot (108)
- # cider (15)
- # clara (4)
- # cljs-dev (12)
- # cljsjs (37)
- # cljsrn (4)
- # clojure (110)
- # clojure-italy (2)
- # clojure-spec (12)
- # clojurescript (168)
- # cursive (1)
- # datomic (24)
- # graphql (6)
- # hoplon (5)
- # jobs-discuss (2)
- # keechma (21)
- # mount (5)
- # off-topic (140)
- # om (2)
- # parinfer (37)
- # planck (6)
- # re-frame (4)
- # reagent (9)
- # rum (2)
- # spacemacs (4)
Hi, I’m trying to write a task that downloads an external less-template and move it permanently to my prj folder. That part works, but I’m stuck with trying to rename the downloaded folder. Task below is mostly based on what cljsjs does:
(deftask download-semantic-ui []
(comp
(download
:url (format "" +semantic-ui-version+)
:checksum "98ba3248a2c74882204235cba06fad5e"
:unzip true)
(sift :include #{#"^Semantic-UI-.*/(.*)$"})
(sift :include #{#"\.js", #"\.json"} :invert true)
(target :dir #{"resources/less"})))
this gives me the folder resources/less/Semantic-UI-LESS-{x.y.z}
while I would like to reference in my own less file resources/less/semantic-ui
How can I rename this?
@freakinruben (sift :move {#"Semantic-UI-LESS-[\d.]*/" ""})
@freakinruben Though I'd just recommend using Semantic UI from webjars and https://github.com/Deraen/less4clj
yeah I did something like that but sift only moves files, not directories.. and it’s quite a nested folder structure inside
If you move all the files, the old directory will be empty
Boot only operates on files, not directories
I will give that a try. Ok, so if I would like to make the above work I’ll have to use some java file methods
It should work
@juhoteperi did you ever manage to use semantic-ui less files through webjars? Question doesn’t really belong in this channel, but in case you did, how did you solve semantic-ui trying to import ../../theme.config
while that file is not present in the jar
@freakinruben I haven't used semantic-ui
Which package are you using? "org.webjars.npm" % "semantic-ui" % "2.2.10"?
You could try adding the file META-INF/resources/webjars/semantic-ui/2.2.10/src/theme.config
under you classpath (i.e. resource-paths) (version number in the path doesn't matter, less4clj ignores that part)
Looks like only the npm version includes the less files
Semantic-ui should work with less4clj/less4j, : https://github.com/SomMeri/less4j/issues/295
wow, that seems too work, adding the file under the path you said.. I tried it before with bower
in the path as well 😄
Great! Looking at the import resolve code, having the file at classpath root might also work (`resources/theme.config`)
Or maybe not. That would work if semantic-ui/src/foo.less
did import ../../theme.config
, but the import is from semantic-ui/src/a/b/something.less
hmm
no, tried every path 😛
resources/theme.config
, ./theme.config
, resources/public/theme.config
etc.
resources/semantic-ui/src/theme.config
nope, only META-INF/resources/webjars/semantic-ui/2.2.10/src/theme.config
seems to work
Hmm, okay
that’s fine, I can just import there from my actual folder and forget about that file
I'll add note about this to less4clj readme
@juhoteperi I’m getting an error with boot-cljs 2.1.1
and boot-cljs-test
> Cannot find module ‘/Users/anmonteiro/.boot/cache/tmp/Users/anmonteiro/Documents/github/lumo/1xed/3lgroc/lumo_test/lumo_test/test_suite.out/goog/bootstrap/nodejs.js’
has this been reported?
this is CLJS 1.9.854
boot-cljs-test
0.3.0
and boot-cljs
2.1.1
(using boot-cljs-test to run my tests in Node)
There is boot-cljs-test 0.3.1 available
and 0.3.2-SNAPSHOT
I get the same error with ^
looks like there’s one extra /lumo_test/
segment in the path
@juhoteperi this is a regression between 2.0.0 and 2.1.1
I just upgraded and started getting the error
2.1 changed the default :asset-path
Perhaps that doesn't work with Node
it might not work with Node
(I don’t have a .cljs.edn
file btw)
not sure if that’s relevant
I think boot-cljs-test creates one
so perhaps this is a bug in boot-cljs-test?
might be related
Can you build something without boot-cljs-test and see if that works?
With Node
Also, you can provide :asset-path
to test-cljs :cljs-opts
to override value Boot-cljs-test sets
or :asset-path
to cljs :compiler-options
trying to build something with Node right now (without boot-cljs-test)
@juhoteperi hrm I guess we need to set asset-path explicitly now then https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1494
what’s the goal behind this change in boot-cljs?
doesn’t seem like a very good default from the Node.js standpoint
I don't think the bug is in Boot-cljs, at least only
Boot-cljs had bug previously, it only used the name of .cljs.edn file to set asset-path default
now it uses path
Boot-cljs-test code now only uses the name of .cljs.edn, that is at least wrong, but I'm not sure if that is what causes this
to make this work in Node I had to use these compiler options:
(cljs :compiler-options {:optimizations :none
:main 'lumo.test-runner
:verbose true
:asset-path "/target/main.out"
:compiler-stats true
:target :nodejs})
I guess boot-cljs-test
will need to use the asset path
It is also possible that the default should be different for Nodejs
Looks like something is prepending asset-path with output-dir or something
"require(path.join(path.resolve(\".\"),\"" asset-path "\",\"goog\",\"bootstrap\",\"nodejs.js\"));\n"
This file is written to :output-dir
so path.resolve(\".\")
will resolve to that?
:cljs-opts {:parallel-build true
:asset-path "test_suite.out"}
works with boot-cljs-test on Lumotrying
works 👍
I also tried nil
but either ClojureScript default doesn't work, or boot-cljs-repl overwrites nil
value
I'll open issue about this
@anmonteiro Btw. it should be safe to include test
in :source-paths
always, and then you could remove the side-effecting testing
task
hrm I can’t remember why I did that
I think it’s copy paste from another project where I didn’t want the test folder in the installed JAR?
I honestly can’t remember
:source-paths
is not included in JARs, only resources are
right
I just tested the boot-cljs only with the conf you posted
It does work with default :asset-path
IF you first cd into the target dir and then run node main.js
which makes sense
because target
was not my output dir
I think the ClojureScript node output is only meant to work when when running from same dir?
yes, there are a few issues around that
in JIRA
perhaps it’s time we clean that up 🙂
And perhaps I should finally start testing boot-cljs with Node 😄
I do have some projects using boot-cljs-test but I don't touch those very often
Oh and I'm using PhantomJS on that project
Updating 293 -> 854 seems to break PhantomJS 😕
well that’s a pretty big update
Ah it was problem with old Schema
oh I’ve definitely seen that
Boot-cljs 2.0 -> 2.1 breaks both phantom and node tests
I think I found another bug in boot-cljs
this one is very minor
I think you’re overriding warnings and there’s a space missing in e.g. undeclared var warnings
between the var name and at line, etc....
just got a warning like undeclared Var my.ns/fooat line ...