2

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?

2 Answers 2

3

It actually is a known issue:

https://javafx-jira.kenai.com/browse/RT-40346

There is a temporary fix available and the issue should be fixed in the next build Java8_u60.

The temporary fix can be made in the CSSParser class. Link to the git diff:

http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/839912277bf0

If you dont want to try the fix or wait for u60, just add all css files to the same folder and import it like that (temporary solution!):

@import "css/test1.css";
@import "test2.css";
@import "test3.css";
@import "testX.css";
Sign up to request clarification or add additional context in comments.

Comments

0

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";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.