Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail to link css file in html file #2223

Open
wangtengda0310 opened this issue Feb 26, 2022 · 3 comments
Open

fail to link css file in html file #2223

wangtengda0310 opened this issue Feb 26, 2022 · 3 comments

Comments

@wangtengda0310
Copy link

my folders tree like:

C:.
│   deps.edn
│   dev.cljs.edn
│
├───resources
│   └───public
│           index.html
│
└───src
    └───hello_world
            core.cljs

my deps.edn

{:deps
 {
 cljsjs/react-dom {:mvn/version "17.0.2-0"}
 cljsjs/react {:mvn/version "17.0.2-0"}
 reagent {:mvn/version "1.1.0"}
 cljsjs/antd {:mvn/version "4.6.1-0"}
 com.bhauman/figwheel-main {:mvn/version "0.2.16"}
 com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
 org.slf4j/slf4j-simple {:mvn/version "1.7.36"}
 }
:paths ["src" "target" "resources"]}

my dev.cljs.edn

{:main hello-world.core}

my resources\public\index.html

<!DOCTYPE html>
<html>
  <head>
    <link href="cljsjs/antd/production/antd.min.inc.css" rel="stylesheet" type="text/css">
  </head>
  <body>
    <div id="app"></div>
    <script src="cljs-out/dev-main.js"></script>
  </body>
</html>

my src\hello_world\core.cljs

(ns hello-world.core
  (:require [antd :as antd]
        [reagent.core :as r]
        [reagent.dom :as rdom]))

(defn c [] [:> js/antd.Calendar])

(rdom/render [c] (js/document.getElementById "app"))

and I start with command

clojure -M -m figwheel.main -b dev -r

but the result is without css

image
image

how can I use the css file?

@wangtengda0310
Copy link
Author

the antd README.md say
image

@Deraen
Copy link
Member

Deraen commented Feb 27, 2022

Figwheel main serves files from the classpath prefix "public/". Cljsjs files aren't under that path so they aren't accessible at least with the default figwheel-main configuration.

https://github.com/bhauman/figwheel-main#classpaths-classpaths-classpaths

It actually serves any file it finds on the Classpath in a public sub-directory.

@wangtengda0310
Copy link
Author

Should I copy cljsjs/antd/production/antd.min.inc.clss from in jar to resources/public/ ?

It's awkward...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants