helix

https://github.com/Lokeh/helix
Aron 2020-12-11T12:34:36.237300Z

how do you import css from npm?

ferossgp 2020-12-11T14:11:50.237400Z

There is a discussion in reagent channel https://clojurians.slack.com/archives/C0620C0C8/p1606990103333000

1
Aron 2020-12-11T14:38:41.239100Z

I am not sure if it helps me though. I am writing a react component, not html.

Aron 2020-12-11T14:39:03.239300Z

Someone else writes it, but for them the css should be bundled with my component

lilactown 2020-12-11T16:39:08.240400Z

No cljs build tool I know of handles asset imports. So you’ll need to include the CSS manually

lilactown 2020-12-11T16:39:29.241Z

If you’re writing a lib, your consumers will need to do the same

lilactown 2020-12-11T16:42:46.242600Z

In the past I’ve used CSS-in-JS libs for this reason; it’s more portable

dominicm 2020-12-11T18:10:46.242800Z

I've not tried the new webpack stuff to see if that works.

Aron 2020-12-11T18:48:21.243Z

this is in-company

Aron 2020-12-11T18:48:51.243200Z

so not a library, obviously, as I said, but also not even a package. I don't have to publish it and only have to work inside our own django application.

Aron 2020-12-11T18:49:27.243400Z

and I am fully aware of webpacks all bloated features are not part of all other bundler's features and I am glad for this because I don't like webpack

Aron 2020-12-11T18:51:09.243600Z

but I can't really expect people who will use my component internally to the react app, to then go to the django template file and inject the required css lines

Aron 2020-12-11T18:54:27.243800Z

similarly, it is not really a good idea to include the css for components that are not present, so if they remove the component, how can I make sure they remove the css from the html templates?

Aron 2020-12-11T18:54:42.244Z

I am really curious what people do to get over this

dominicm 2020-12-11T19:17:32.244200Z

Webpack :)

dominicm 2020-12-11T19:17:52.244400Z

Or css-in-js

Aron 2020-12-11T19:35:01.244600Z

I see that you see why I ask 🙂

Aron 2020-12-11T19:35:55.244800Z

it shows that clojure is still mostly about backend, because I expect if your backend is clojure, this just goes to a bunch of other backend scripts. E.g. I could use some django plugin

dominicm 2020-12-11T20:16:13.245Z

And how does django find the css? My recollection is fuzzy here, but I'm sure there's a manifest you can generate.

dominicm 2020-12-11T20:16:20.245200Z

Or python

Aron 2020-12-11T21:15:18.245400Z

I am not that good with python/django, so I don't know

Aron 2020-12-11T21:16:12.245600Z

There is a thing called collectstatic that needs to run before deploy. But even that is not the defacto standard or anything, and people do all kinds of weird things, like in php. At least that's my impression

dominicm 2020-12-11T21:43:08.245800Z

Django is pretty standardized, it's not as wild west as php. Although that's rounding up with things like composer.

dominicm 2020-12-11T21:46:28.246200Z

https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-STATICFILES_DIRS can have your library added to it, and you're good to go.

Aron 2020-12-11T21:53:47.246400Z

yeah, but that's not very dynamic, is it?

Aron 2020-12-11T21:53:53.246600Z

it's even called static

Aron 2020-12-11T21:55:29.246800Z

guess i am overoptimizing or something, but this whole setup feels ad hoc

dominicm 2020-12-11T22:03:46.247Z

I don't understand what dynamic would be here.

Aron 2020-12-11T22:28:17.247200Z

Sorry, I realized in the meantime that I am coming at this from the wrong angle. Let me try differently: I would like to not have to consciously think about including or not including css dependencies of my dependencies.

Aron 2020-12-11T22:29:22.247400Z

I should've been more specific, but I am only figuring this out now, sorry.

dominicm 2020-12-11T22:47:50.248Z

That's OK. Most of what I ever ask is implicit. I like Clojure's melting pot because we're all so different and have very little shared background. Opens us up to new ideas.

dominicm 2020-12-11T22:48:40.248300Z

So you're like building a thing, and you depend on another thing, which itself has CSS? And you'd like to automate the process of bundling all those up automagically?

dominicm 2020-12-11T22:50:26.248500Z

That sounds exactly like webpack to me :) (or any other bundler)

Aron 2020-12-11T23:00:29.248700Z

yeah