Fork me on GitHub
#clojurescript
<
2022-02-02
>
Joshua Suskalo02:02:49

What would be a good set of beginner materials for someone looking to make a simple clojure/script client and server for a small webapp? Are the old modern-cljs tutorials still relevant? I feel like cljs moves fast enough that 4 years out of date is likely pretty old by now.

Joshua Suskalo02:02:40

(I'm looking to make a simple blog, but in order to stretch my skillset a little bit I've decided I want to do full stack with it and go above and beyond on features compared to a static site, like allowing comments via oauth connected applications or something similar)

Joshua Suskalo02:02:13

Ideally something that uses deps.edn/the clojure cli, but that's not a requirement

dnolen15:02:38

@suskeyhose also if you're not going to reach for modern JS stuff and want to keep it really simple - lots of old content is quite accurate

dnolen15:02:08

a Ring server + plain ClojureScript can go a long way especially if you're not building anything complicated UI-wise

Joshua Suskalo15:02:23

That's fair, and is likely what I'd like to do. I've had a friend help out with getting shadow set up, and I know enough about reagent to get by.

dnolen15:02:36

as useful as modern JavaScript libraries can be they bring a lot of baggage

JohnJ16:02:56

Curious, examples of such libraries?

JohnJ18:02:40

or to reframe it another way, by 'plain clojurescript' you mean no react?

dnolen21:02:53

yes just Google Closure Library if you're doing something simple to avoid JS ecosystem complications

Joshua Suskalo15:02:18

I was initially wanting something more complex with some SSR going on so that the client wouldn't have to render an md file to html with cybermonday, but could still use reagent to represent the rest of the UI, but at this stage that just seems infeasible unless I made it server-side components, which is a big thing I don't really want to get into yet.

neilyio16:02:05

Sometimes I find that after a :whitespace, :simple, or :advanced compilation, I get browser console errors like the following:

main.js:47 goog.require could not find: goog.Disposable
main.js:47 goog.require could not find: goog.asserts
main.js:47 goog.require could not find: goog.debug.EntryPointMonitor
main.js:47 goog.require could not find: goog.debug.Error

neilyio16:02:44

I have pretty minimal compiler options, and no node dependencies. Why might a few Google Closure namespaces be missing?

(cljs.build.api/build {:output-dir    "compiled"
                       :output-to     "compiled/js/main.js"
                       :asset-path    "/js"
                       :main          "main.core"
                       :optimizations :whitespace
                       :target        :browser})

maverick16:02:35

I am trying to open a PDF file inside Modal. I tried to use embed in clojurescript but it is showing me blank. How can we use embed in cljs?

p-himik16:02:55

What is embed?

p-himik17:02:15

> Keep in mind that most modern browsers have deprecated and removed support for browser plug-ins, so relying upon `<embed>` is generally not wise if you want your site to be operable on the average user's browser. With that being said, CLJS has nothing to do with this. <embed> tag is a standard functionality - if it works, it should work everywhere. You'd use it in CLJS the same exact way you'd use it anywhere else. If something doesn't work here, then the problem is elsewhere. Maybe React (assuming you're using it - you haven't specified) doesn't like <embed>, maybe your resource is not available, maybe your browser has some strange restrictions, maybe something else. It's 100% not about CLJS.

maverick09:02:07

Okay Thanks @U2FRKM4TW

👍 1
dnolen17:02:48

@neil.hansen.31 the REPL needs to be aware of changes to Google Closure Library - if Weasel hasn't been kept up-to-date this is going to be a problem

neilyio17:02:19

Thanks for the insight!

dnolen17:02:27

oh but you're not talking about the REPL in this case?

dnolen17:02:06

goog.require runtime errors w/ :advanced :simple and :whitespace is not possible

dnolen17:02:13

goog.require gets erased

dnolen17:02:25

so if you are seeing those - something else is probably going wrong

dnolen17:02:27

nothing to do w/ compilation

p-himik17:02:03

One idea - you copied only the main file from the dev build, instead of using the one from the optimized build.

Richard Bowen22:02:01

Anyone working with TailwindCSS?

3
mikerod22:02:46

Does anyone have a good example of how to include css from an npm lib when using the bundle cljs target? Usually this could be done in the entry js file but the bundle target automatically creates that (by default which removes a lot of boilerplate otherwise)

p-himik22:02:19

AFAICT people usually do it using a more manual approach. Your build step copies the relevant CSS files to the location from which your web server serves them, and you includes those files in your HTML.

mikerod22:02:44

That’s sort of what I figured. Thanks. I will look into that idea

👍 1
Arthur14:02:40

Using some CDN to include these files into your HTML might work as well. I isually use unpkg for this

👍 1
mikerod14:02:02

Yeah I actually have to embed them in this case