klipse 2017-06-06

I want to add cljs-time to my klipse blog … is this supported? [https://github.com/andrewmcveigh/cljs-time]

You need to try

but cannot see how to bring a CLJS lib in

It’s not explained here

that’s a relief 😉

You need to have a klipse snippet with data-external-libs=

And the content of the snippet will something like : require '[cljs-time.core :as t]

data-external-libs is like the classpath

I’ll give it a go

it tells klipse where to resolve the namespaces

but wasn’t sure how to form the URL for the lib

I guess I could also use a tag rather than master

yes

it might be a better idea

I’d appreciate if you could improve the instructions for using external libs

it confuses a lot of people

sure - if I get it to work, I’ll try to help

Awesome:metal:

it’s not working yet so don’t get to excited 😛

ah

#error {:message “No such namespace: cljs-time.core, could not locate cljs_time/core.cljs, cljs_time/core.cljc, or Closure namespace \“cljs-time.core\“”, :data {:tag :cljs/analysis-error}}

this is the code I have…

sorry, I made a mistake in the data-external-libs

It has to be: data-external-libs=

Notice the src at the end

yes, makes no difference

maybe it should have /cljs_time also

no

what error do you see now?

#error {:message “No such namespace: cljs-time.core, could not locate cljs_time/core.cljs, cljs_time/core.cljc, or Closure namespace \“cljs-time.core\“”, :data {:tag :cljs/analysis-error}}

I am doing it within a deckjs presentation

It shouldn’t make a difference

Let me try

I thought not but mention it for completeness

What’s the topic of your presentation?

It’s a bunch of jokes about Clojure and FP, written in Clojure

I previously had to swap between keynote and the terminal

and I would rather do it all in one 🙂

Yeah!

for example I make a macro called joke that can be called with a story and a punchline

but it has no side effects

and jokes should always have a side effect

otherwise it’s a quantum joke

I'm screenshoting that

The four sentences, out of context it's hilarious

LOL, it’s meant to be a joke so I’m happy about that 🙂

I can see I’m going to have t o be careful not to reveal too much here!

It was last year's EuroClojure where you did a clojure jokes "unsession" or something, right?

yes, I’m hoping to do the same this year too

I have an unsession booked at least

Cool, I'll probably book my ticket and flight sometime this week, when are the unsessions?

normally on the Thursday evening

Perfect, I was disappointed not to go to EuroClojure last year, hopefully I'll see your unsession this year.

that would be great

@raymcdermott I think I found the issue

Could you try

(require 'goog.i18n.DateTimeSymbols
         '[cljs-time.core :as t])

?

#error {:message “Could not eval my.klipse”, :data {:tag :cljs/analysis-error}, :cause #error {:message “Only :as alias, :refer (names) and :rename {from to} options supported in :require; offending spec: (quote goog.i18n.DateTimeSymbols) at line 1 “, :data {:file nil, :line 1, :column 1, :tag :cljs/analysis-error}}}

can you show me the page source?

#error {:message “Could not eval my.klipse”, :data {:tag :cljs/analysis-error}, :cause #error {:message “Only :refer-clojure, :require, :require-macros, :use, :use-macros, and :import libspecs supported. Got (require (quote goog.i18n.DateTimeSymbols) (quote [cljs-time.core :as t])) instead. at line 1 “, :data {:file nil, :line 1, :column 1, :tag :cljs/analysis-error}}}

I used :require, not require first

That should work also

oh no!

You cannot put (require) inside a ns

You have to use :require

but without the quotes

I had that… but OK let me revert

Also it is better to put the require statement in a separate snippet

Then it is not re-evaluated when you modify your code

#error {:message “No such namespace: cljs-time.core, could not locate cljs_time/core.cljs, cljs_time/core.cljc, or Closure namespace \“cljs-time.core\“”, :data {:tag :cljs/analysis-error}}

also, you have a typo

It should be

<code class="clojure"
              data-external-libs="https://raw.githubusercontent.com/andrewmcveigh/cljs-time/master/src/">

LOL yes the typo

OK, it’s working now!!

COOL!!!

does Klipse support macros (I assume yes)

yes

OK, let me play with that and I promise to do a little write-up on external libs

When using macro, you have to do a special trick with the namespace

And be careful not to create more than 1 ns in your presentation

otherwise it’s going to be a big mess

And I have a surpris for you

While we were talking, I have added cljs-time to the analysis cache of Klipse

so can I put the ns/require in a snippet at the top and assume it’s going to be usable everywhere?

correct

Starting from Klipse version 7.1.1

you don’t need the data-external-libs

in order to use cljs-time

and it loads much faster

so will that get picked up automagically now?

exactly

yes

You can check the browser console

to see what version you get

ok, I’ll give it a shot

boom, yes that works

something else I’m having an issue with…. hiding code

the snippet is not hidden at all!!

you see my problem

You need to create a css rule that hides element with class hidden

something like

oh, I thought that was with klipse

.hidden {
visibility: hidden
}

It’s not part of klipse

it’s in the manual

is it form the gitbook?

that’s because gitbook has such a css rule

Probably, I need to make it clearer

the css rule does not collapse the space that the code would have occupied

I’m not a CSS guru

so any clues would be appreciated

.hidden { display: none; }

does the right thing - the visibility CSS rule is literally bullshit

I have the macros working now too - so that’s cool and the gang