Fork me on GitHub
#leiningen
<
2018-07-09
>
shen16:07:55

Not 100% sure where to ask this, but is there a sane way to package/distribute CSS as a maven dependency?

shen16:07:48

I see some packages in cljsjs/packages includes CSS

mikerod16:07:17

@shen getting CSS into a jar is the same as putting anything else in it, e.g. putting it in resources etc

mikerod16:07:36

to have a downstream project consume that CSS though, is a the trickier side

shen16:07:55

that's what I'm wondering

mikerod16:07:05

there are a few good plugins I’ve used and like for it

shen16:07:13

surely (dangerous word) people put css in so they can use it later?

mikerod16:07:24

deraen/lein-sass4clj

shen16:07:11

does that not build the sass in your own project though?

shen16:07:39

feels like we want something that copies the css from a dependency to an accessible location

mikerod16:07:30

So if I bring in a lib and it has some css file in the jar with path called some-project-path/some-project.css You can make it a file, e.g. some-project-import.scss

/* NOTE: Any changes to this file needs to have a subsequent run of `lein sass4clj once` */

@import "some-project-path/some-project";


mikerod16:07:40

it does build it in your own

mikerod16:07:55

so it is a preprocess step

shen16:07:23

hm. so it's using the sass compiler to do a copy?

mikerod16:07:50

I typically just do the lein sass4clj manually, but if you upgrade the dep, you’d need to recreate - you could automate it more in the project.clj as a preprocess step if you wanted it to happen more often/on-demand or whatever

mikerod16:07:01

yep, uses sass for it

mikerod16:07:31

if you want to use less - it’s similar

shen16:07:30

is this a bit of a weird thing to do? distribute css using maven?

mikerod17:07:13

it seemed ok to me, hah

mikerod17:07:30

I mean if trying to share a cljs lib and wanting to provide some default styling

mikerod17:07:44

I guess you could also do something different, like put the css up on a cdn somewhere

mikerod17:07:55

via perhaps an alternative deployment

shen17:07:24

ja. I'm kind of doing the later now

mikerod17:07:50

I just run the lein sass4clj when a change happens to that dep, I check in the source to source control

mikerod17:07:04

typically you make the css file with a name like

mikerod17:07:10

my-styles.inc.css I believe

mikerod17:07:31

the inc stands for “include” I think - not sure this convention. I think it is used in cljsjs libs thoguh

mikerod17:07:59

you could also do minimized variants with minimizing tools I believe

mikerod17:07:35

and use foreign-libs or just <include> tags for min vs full etc

shen17:07:06

ok. thanks @mikerod!

👍 4