'Java FX CSS @import path issue
In Java8_31 I imported different CSS files like that in my main.css:
@import "style/common/test1.css";
@import "style/common/test2.css";
All files were in the package style/common and it worked great.
Now with the build Java8_40 I did the same thing, but I get the following error message:
Could not find stylesheet: file:/mypath/../style/common/style/common/test2.css com.sun.javafx.css.parser.CSSParser handleImport
All my styles from the CSS file test1.css are working. What I was curious about was the fact that my path style/common is showing up two times.
So I tried to change my imports to the following:
@import "style/common/test1.css";
@import "test2.css";
With these imports, both styles of the file test1 and the file test2 are working. But both files are still in the same package.
Whats happening here? Is there a known issue about the @import and probably a problem in the CSSParser?
Solution 1:[1]
Just contributing to the discussion (not directly to your question): You don't have to explicitly set the full .css file path. All you need is to specify the .css folder and the file name:
Original path:
@import "css/nodes/path/CssFile.css";
Full path without folder specification:
@import "../../path/CssFile.css";
Both work the same. Notice that, in the second example, "../" refers to the path level, not the specific folder name.
So in your case, that would be
@import "../common/test1.css";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | FARS |
