-
Notifications
You must be signed in to change notification settings - Fork 815
Non JS Assets
Juho Teperi edited this page Feb 26, 2016
·
22 revisions
The :foreign-libs
feature provided by Clojurescript does not have
any support for non-JavaScript files like CSS files and images.
Many JavaScript libraries depend on additional assets like CSS and images.
Currently there is no predefined way to solve this problem. This page is meant to document and discuss ongoing efforts in this area.
-
A Boot-specific solution utilizing the fileset is documented in boot-cljsjs #21 (fleshing this out into a Wiki page would be welcome).
-
A similar approach has been discussed in the Hoplon forum
-
An example, using
cljsjs/c3
. Inbuild.boot
:(deftask build [] (comp (sift :add-jar {'cljsjs/c3 #"^cljsjs/c3/common/c3.min.css$"}) (cljs)))
In
index.html
:<link rel="stylesheet" type="text/css" href="cljsjs/c3/common/c3.min.css">
less4clj and sass4clj can import files directly from classpath. This makes it easy to embed files from jar dependencies in CSS.
// Less
// http://lesscss.org/features/#import-directives-feature
@import (inline) "cljsjs/production/fixed-data-table.min.inc.css";