Skip to content

fail to link css file in html file #2223

Description

@wangtengda0310

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?

Activity

  1. wangtengda0310 commented on Feb 26, 2022

    @wangtengda0310
    Author

    the antd README.md say
    image

  2. Deraen commented on Feb 27, 2022

    @Deraen
    Member

    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.

  3. wangtengda0310 commented on Mar 14, 2022

    @wangtengda0310
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions