This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-15
Channels
- # beginners (26)
- # biff (28)
- # calva (13)
- # clj-commons (4)
- # clj-kondo (3)
- # clojure (45)
- # clojure-austin (17)
- # clojure-europe (8)
- # clojure-finland (1)
- # clojurescript (14)
- # code-reviews (3)
- # emacs (33)
- # helix (4)
- # holy-lambda (7)
- # joyride (5)
- # keechma (1)
- # meander (4)
- # membrane (3)
- # missionary (22)
- # nbb (1)
- # off-topic (1)
- # pathom (4)
- # rdf (24)
- # releases (2)
- # sci (3)
- # shadow-cljs (12)
- # tools-deps (14)
Installing https://fomantic-ui.com/introduction/getting-started.html#installing-via-npm using NPM, it ends up with the pre-compiled css and js files inside node_modules/fomantic-ui/dist/
. If I want to include them in my html, what is the right way to refer to their location?
I suppose I can just move the files to some location in my path like "resources/public/fomantic-ui/"
, but if anyone knows of a better way to make these files accessible please let me know.
I would write a JavaScript file that imports and requires the compiled CSS and then include that in your code
@U3BALC2HH so I install with NPM and the compiled CSS+JS files end up in node_modules/...
. My public HTML files do not have access to the files in node_modules (I think..?)... sorry, I'm confused, could you elaborate please?
nope! Here's an example:
// <projectRoot>/src/js/index.js
import 'draft-js/dist/Draft.css';
(ns myproject.core
(:require "/src/js/index.js"))
so in your case it would probably be something like fomantic-ui/dist/something.css
(keep in mind this won't work well if you are trying to distribute the code as a library, but it would work if you're making an npm module or some kind of app with no downstream consumers)
@U3BALC2HH thank you for the example. I will try that out. Is there any advantage to doing this instead of just moving the dist files after installing?
I just made a testing project where I only use the browser-repl and node-repl, so no builds. shadow-cljs.edn
looks like so
{}
Starting this with
npx shadow-cljs browser-repl
works fine. But with
npx shadow-cljs node-repl
I get:
% npx shadow-cljs node-repl
------------------------------------------------------------------------------
WARNING: shadow-cljs not installed in project.
See
------------------------------------------------------------------------------
shadow-cljs - config: /Users/pez/.config/joyride/shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
[2022-10-15 13:43:16.382 - WARNING] TCP Port 9630 in use.
[2022-10-15 13:43:16.385 - WARNING] TCP Port 9631 in use.
shadow-cljs - server version: 2.20.5 running at
shadow-cljs - nREPL server started on port 57047
cljs.user=> SHADOW import error /Users/pez/.config/joyride/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.js.shim.module$ws.js
[stdin]:66
throw e;
^
Error: Cannot find module 'ws'
Require stack:
- /Users/pez/.config/joyride/[stdin]
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at /Users/pez/.config/joyride/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.js.shim.module$ws.js:3:28
at global.SHADOW_IMPORT ([stdin]:63:44)
at [stdin]:1535:1
at [stdin]:1579:3
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:313:38)
[2022-10-15 13:43:18.498 - INFO] :shadow.cljs.devtools.server.repl-impl/node-repl-exit - {:code 1}
SHADOW import error /Users/pez/.config/joyride/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.js.shim.module$ws.js
[stdin]:66
throw e;
^
And a lot of those. Then a lot of:
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> SHADOW import error /Users/pez/.config/joyride/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.js.shim.module$ws.js
Failed to read: java.io.IOException: Input/output error
cljs.user=> [stdin]:66
throw e;
^
Error: Cannot find module 'ws'
Require stack:
- /Users/pez/.config/joyride/[stdin]
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at /Users/pez/.config/joyride/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.js.shim.module$ws.js:3:28
at global.SHADOW_IMPORT ([stdin]:63:44)
at [stdin]:1535:1
at [stdin]:1579:3
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:313:38)
Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
cljs.user=> Failed to read: java.io.IOException: Input/output error
Am I missing some minimal config for this to work with node-repl?Adding shadow-cljs
to my node project fixed this. Don't know if it was because npx
otherwise runs some old version...
npx otherwise runs a globally installed version. you need to project install, so it provides the ws
dependency among others. thats why there is the WARNING: shadow-cljs not installed in project.
warning
Thanks! I have for very long wondered about that warning. 😃 Never run into problems skipping it. Most often I have not skipped it, though, so maybe that has to do with it. It was the warning that got me to try to fix my problem with the install, though, so it did its work. Maybe add problems might ensue to the message for thick-heads like me.
Adding shadow-cljs
to my node project fixed this. Don't know if it was because npx
otherwise runs some old version...