This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-08-09
Channels
I'm trying to use semantic-ui with shadow-cljs and reagent but it seems there is no equivalent for
import 'semantic-ui-css/semantic.min.css'
As far as I know shadow-cljs doesn't support importing CSS files into CLJS
But do you need to? Isn't it just a CSS file you can import with <link>
?
Thanks @U02FVPF04A1, I did that in the end. Just wondering if there was any other solution. The app will be embedded in different sites I wanted to avoid that step.
You could always dynamically create the element and append it to the <head>
via CLJS alone, no need to change the HTML. Maybe thats what you did!
Could you elaborate more @U02FVPF04A1 π
Ah I see, using something like
var sc = document.createElement("script");
sc.setAttribute("src", "");
sc.setAttribute("type", "text/javascript");
document.head.appendChild(sc);
If you happen to be using React 19 (unlikely) you can also render a <script>
or <link>
element directly and React will handle the rest; kinda cool!
Also for older versions of react thereβs react helmet lib that takes care of rendering these tags into head
I am trying to create an npm module and I noticed that when you run the release command it does not create a package.json
file in the module.
Is there a way to do that? So that I can then import it via npm into my react project?
package.json you'll need to generate yourself. just a npm init
will get you started and usually its only a small trivial adjustment from there
for example the shadow-cljs
npm package files sit here https://github.com/thheller/shadow-cljs/tree/master/packages/shadow-cljs
Okay. That is actually helpful. I've never delved much into the contents of package.json. I'll have to look for the keyword to include various files.
.
βββ app.nodes.test_node.js
βββ cljs.core.js
βββ cljs_env.js
βββ package.json
This look about right to you? The files were generated by running shadow-cljs release
This is the package.json
{
"name": "test-module",
"version": "1.0.0",
"description": "",
"main": "app.nodes.test_node.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
you may need to add dependencies
if you have actual npm dependencies in that package
This worked. Thanks a lot.