This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-12
Channels
- # announcements (1)
- # babashka (79)
- # beginners (165)
- # calva (29)
- # cider (20)
- # clara (3)
- # cljdoc (1)
- # cljs-dev (52)
- # clojure (42)
- # clojure-chicago (5)
- # clojure-europe (48)
- # clojure-germany (1)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-spec (10)
- # clojure-uk (19)
- # clojurescript (50)
- # clojureverse-ops (5)
- # conjure (8)
- # datomic (16)
- # depstar (2)
- # events (1)
- # figwheel-main (23)
- # fulcro (26)
- # girouette (41)
- # graalvm (9)
- # heroku (3)
- # honeysql (10)
- # jackdaw (20)
- # lambdaisland (6)
- # lein-figwheel (1)
- # lsp (34)
- # malli (7)
- # meander (3)
- # music (1)
- # off-topic (14)
- # polylith (7)
- # re-frame (14)
- # reitit (8)
- # reveal (15)
- # ring (3)
- # schema (1)
- # sci (15)
- # shadow-cljs (42)
- # spacemacs (1)
- # startup-in-a-month (12)
- # tools-deps (59)
- # vim (1)
- # xtdb (27)
Is there any way to try to make girouette a drop-in replacement for tailwind?
What I mean is, I'd like be able to write {:class (css ["inline-block" "underline"])}
like {:class '[inline-block underline]}
.
I think it is already the case, except that it currently takes strings and not symbols.
Take a look at the example project in the repository.
Alright, following the above example, it looks like I can do {class '["inline-block" "underline"]}
.
It's not difficult to change. It's probably in the preprocessor project.
Perhaps you can point me in the right direction. I'm trying to get symbols to work, but I don't know what other steps in the chain I should look at. This is my progress so far. I also did a bit of refactoring as I saw fit, but feel free to ignore those changes if you think your way was more readable. https://github.com/wildwestrom/girouette/blob/develop/lib/processor/src/girouette/processor.clj
Sorry, the analyzer is not so easy to use.
I cannot look at it at the moment because I am still working.
I noticed that keywords are supported. Would that work for you?
They do work, and under certain circumstances I'll use them, but I still want to make this work. I'll keep at it.
I think that I did not support symbols by design, thinking that string and keywords would be good enough.
Maybe I have to edit this function?
(def hiccup-tag-grammar "
hiccup-tag = html-tag (<'#'> id | (<'.'> class-name))*
html-tag = segment
id = segment
class-name = segment
<segment> = #'[^\\.#]+'
")
Well, I'm a little stumped, I gotta say. It was certainly fun refactoring the processor. I'm gonna sleep on this one and maybe I'll figure out how instaparse works.
Hi. The hiccup-tag-grammar is for parsing the keywords inside a hiccup structure. You probably don't need to touch it.
I see. So right now I'm trying to figure out where exactly the program takes in the strings. It seems like cljs.analyzer.api
is the library in gather-css-classes
that does the parsing. I found that it does something called passes
after taking in the whole file. So each of these passes
has some regex and destructuring for keywords and strings, it would seem that all I need to do is add some regex or something to take symbols in. That's where I'm stuck.
> Sorry, the analyzer is not so easy to use. Yes ..
What regex?
(def receive-hook-fn
{:keyword #(->> (name %)
(re-seq #"\.[^\.#]+")
(map (fn [s] (subs s 1))))
:string #(->> (str/split % #" ")
(remove str/blank?))
:symbol #(->> (name %)
(re-seq #"[\S]+"))})
I may have time to take a look tonight.
Merged. Thank you !
I just realized that this processor will take in strings, keywords, and symbols, however it does so indiscriminately. I guess that's why there was so much red text after the processor did its thing. How did you test the analyzer so you could see the AST of whatever file was put in?
Nevermind, I got the hang of it.
You were certainly right that it's difficult, but it's better than trying to use bean
on Java classes and methods.
There are plans to rewrite the processor at some point, using rewrite-clj, so no need to spend too much time on it.
The whole reason I'm working on this is because I want to use it on my website. I really want to get this working properly.
The "false positives" you are getting when gathering the symbols should not stop you in your process. I wouldn't worry about it if I was you. In the worse case, some of the symbols will match the grammar used by Girouette and your CSS file will be slighly bigger .. you might not even feel it.
Awww damn, I think I introduced a bunch of bugs into the program with this change. Not only is it detecting false positives, but it's also detecting false negatives.
Should I revert the commit?