Comments (11)
For figwheel to work you have to have your css below the web root directory. Look at the example project. This defaults to resources public.
The url you should be seeing is "//localhost:3449/css/app.css?rel=1414087417074".
If you are using the default setup you just need to move your css folder into the resources/public directory.
If that's not going to help you can you send me your cljsbuild and figwheel config info from your project.clj?
from lein-figwheel.
Thanks for clarifying that! With a little bit of work I've got the CSS I want reloading into resources/public, but now I'm hitting a new issue. It looks like figwheel doesn't have CORS headers set for fonts:
Font from origin 'http://localhost:3449' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://circlehost:8080' is therefore not allowed access.
from lein-figwheel.
I find it strange that you are having this problem. Where is the font request being generated from? If it's being generated from CSS what is the origin of the CSS file?
A general solution for your problem in the near term is to use the :url-rewriter client configure option. Supply :url-rewriter with a function that takes a URL and returns a URL that points to the asset in your app server.
from lein-figwheel.
Sorry your having these troubles I look into having a open CORS configuration. I didn't think Figwheel needed it.
from lein-figwheel.
No worries! I'm a little surprised too, but certainly appreciate the help.
Here's an example of the CSS that's triggering this:
@font-face {
font-family: ProximaNova;
src:url('../../webfonts/ProximaNova300.eot');
}
Where the CSS is in /public/css/app.css
from lein-figwheel.
I have the same issue (with the fonts) when I'm loading the page from my own ring server and thus the CSS is loaded from e.g. localhost:8080 when loading the page the first time. When figwheel reloads the CSS it's loaded from port 3449 and browser refuses to load the fonts.
Looks like I can use :url-writer
to fix this but it would be nice if it worked by default.
Would it make sense if files were reloaded from the current host instead of figwheel server?
from lein-figwheel.
I here you here. I'm currently suffering from adding CSS reloading as a convenient afterthought.
Reloading from the Figwheel server makes sense because I know for sure what that path is and for other several other reasons. The path to assets on a custom server can be arbitrary and would require configuration to know it.
Fetching from the figwheel server allows it "to just work" in a great many cases.
I thought that script and link tags wouldn't trigger CORS problems but I didn't think it through fully. I'm going to add the CORS headers and hopefully that will fix it.
I'm not planning on focusing on CSS reloading as it gets really complex and there are many solutions out there already.
Sound fair?
On Nov 1, 2014, at 4:28 AM, Juho Teperi [email protected] wrote:
I have the same issue (with the fonts) when I'm loading the page from my own ring server and thus the CSS is loaded from e.g. localhost:8080 when loading the page the first time. When figwheel reloads the CSS it's loaded from port 3449 and browser refuses to load the fonts.
Looks like I can use :url-writer to fix this but it would be nice if it worked by default.
Would it make sense if files were reloaded from the current host instead of figwheel server?—
Reply to this email directly or view it on GitHub.
from lein-figwheel.
Sounds fair.
This is what I used to get my project working:
:url-rewriter (fn [u] (clojure.string/replace u ":3449" ":3000"))
Maybe there should be a note about :url-rewriter
somewhere in the docs?
from lein-figwheel.
There should absolutely be a note about :url-rewriter in the docs. Working on it.
from lein-figwheel.
Just added cors headers and confirmed that it fixes the font-face problem in Chrome.
I'll hopefully have a release today.
from lein-figwheel.
Added the :url-rewriter
docs
from lein-figwheel.
Related Issues (20)
- scss reloading not being triggered HOT 2
- Why is it named figwheel? HOT 1
- Buffers won't connect to CIDER/Figwheel REPL HOT 1
- Figwheel fails to recognize Java version - issues bad warning HOT 5
- Update REPL integration wiki documentation
- Code reloading fails if you use goog namespace
- Separate builds should truly be separate
- Hello world template opens REPL and detects changes but does not run HOT 1
- Erroneous java version warning HOT 1
- REPL and line splitting mid-form HOT 2
- Confusing project.clj syntax error
- How to create production build? HOT 1
- Unable to change Figwheel server-port HOT 1
- Support non-boolean values for :output-wrapper compiler option
- Uncaught ReferenceError: on_js_reload is not defined
- websocket connection-url should default to window.location.hostname instead of localhost HOT 1
- unable to change websocket-host to window.location.host HOT 1
- Can get the nrepl session establshed HOT 1
- On a brand new project `lein figwheel` -> `java.lang.NullPointerException`
- Running lein figwheel throws java.lang.NullPointerException: Cannot invoke "clojure.lang.IFn.invoke(Object)" because "loc" is null HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lein-figwheel.