This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-06
Channels
- # admin-announcements (10)
- # alda (78)
- # arachne (33)
- # bangalore-clj (2)
- # beginners (11)
- # boot (70)
- # chestnut (8)
- # cljsjs (5)
- # cljsrn (4)
- # clojure (212)
- # clojure-art (1)
- # clojure-berlin (1)
- # clojure-brasil (27)
- # clojure-canada (6)
- # clojure-colombia (12)
- # clojure-dev (6)
- # clojure-greece (29)
- # clojure-hk (2)
- # clojure-italy (7)
- # clojure-russia (51)
- # clojure-spec (12)
- # clojure-uk (18)
- # clojurescript (115)
- # clojurex (8)
- # component (1)
- # crypto (41)
- # css (5)
- # cursive (31)
- # datomic (17)
- # defnpodcast (7)
- # emacs (9)
- # flambo (1)
- # funcool (4)
- # juxt (29)
- # off-topic (1)
- # om (122)
- # onyx (12)
- # pedestal (1)
- # planck (10)
- # portland-or (1)
- # re-frame (30)
- # reagent (4)
- # rum (3)
- # slack-help (2)
- # specter (20)
- # sql (3)
@slester are you familiar with macros to some degree?
No idea if this snippet will work but essentially you'd read your file in Clojure and put it's contents into your cljs file:
(defmacro inline-json [file-path]
`(js/JSON.parse ~(slurp file-path)))
does that basic idea make sense @slester ?
yep! it's saying slurp
is undefined, but I can just (def names (inline-json "names.json"))
from there?
@slester do you know that macros for Clojurescript need to be defined in Clojure files?
Maybe this gives some pointer http://blog.fikesfarm.com/posts/2016-01-05-clojurescript-macros-calling-functions.html
I gotta go, much success 👍