-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
CSS isn't reloading properly #47
Comments
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? |
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:
|
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. |
Sorry your having these troubles I look into having a open CORS configuration. I didn't think Figwheel needed it. |
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 |
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 |
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?
|
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 |
There should absolutely be a note about :url-rewriter in the docs. Working on it. |
Just added cors headers and confirmed that it fixes the font-face problem in Chrome. |
Added the |
I've got the following in the project.clj file that I'm trying to use figwheel with.
This is what I've got in the cljs app:
Whenever CSS files are changed, it tries to reload the CSS with the following URL:
The issue appears to be that there's not a / after 3449 in the URL.
The text was updated successfully, but these errors were encountered: