# Best practices for importing raw text files into ClojureScript projects?

**URL:** https://clojureverse.org/t/best-practices-for-importing-raw-text-files-into-clojurescript-projects/2569
**Category:** shadow-cljs
**Created:** [July 31, 2018, 2:30am UTC](https://clojureverse.org/t/best-practices-for-importing-raw-text-files-into-clojurescript-projects/2569 "2018-07-31T02:30:49Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![jiyinyiyong](https://clojureverse.org/user_avatar/clojureverse.org/jiyinyiyong/32/85_2.png) [@jiyinyiyong](https://clojureverse.org/u/jiyinyiyong)
#### Post date: [August 1, 2018, 11:55am UTC](https://clojureverse.org/t/best-practices-for-importing-raw-text-files-into-clojurescript-projects/2569/10 "2018-08-01T11:55:11Z")

</div>

> [@bensu](#):
>
> (defmacro inline-resource [resource-path] (slurp ([clojure.java.io/resource](http://clojure.java.io/resource) resource-path)))

I ended up running with this piece of code in shadow-cljs:

```clojure
(defmacro inline-resource [resource-path]
  (slurp resource-path))

```

What does `clojure.java.io/resource` do actually? There was an error when I was using it:

```auto
   4 | (def files
   5 | [{:name "Component base", :content (inline-resource "snippets/component-base.tsx")}])
--------------------------------------------^-----------------------------------
IllegalArgumentException: Cannot open <nil> as a Reader.
	clojure.java.io/fn--10992 (io.clj:288)
	clojure.java.io/fn--10992 (io.clj:288)
	clojure.java.io/fn--10894/G--10870--10901 (io.clj:69)
	clojure.java.io/reader (io.clj:102)
	clojure.java.io/reader (io.clj:86)
	clojure.core/apply (core.clj:659)
	clojure.core/slurp (core.clj:6862)
	clojure.core/slurp (core.clj:6862)

```

---

_[View the full topic](https://clojureverse.org/t/best-practices-for-importing-raw-text-files-into-clojurescript-projects/2569)._
