Hello guys!! I'm trying to import css styles, but ...
# tornadofx
s
Hello guys!! I'm trying to import css styles, but seems to be not working, my code:
Copy code
class FibraApp : App(RootView::class) {

    init {
        importStylesheet("file:css/styles.css")
        reloadStylesheetsOnFocus()
    }
}
Styles.css
Copy code
tab {
    font-size: 150px;
    background-color: black;
}
What I'm doing wrong?
Also, If I test with type safe css, they are not reloading when focus, so it's frustrating 😞
e
If reload doesn't work, you probably aren't running in debug mode 🙂
About the stylesheet, show your project layout. Why aren't you referencing it as a classpath resource?
s
jmmm, how can I run it into debug mode? I'm using the gradle application plugin
e
You're not running it from IDEA? That sounds cumbersome. I have no idea how to make the gradle app plugin run in debug mode, see if they have any documentation for that. Or better yet, launch from IDEA.
s
If I try to launch it from IDEA with Tornado run config, it doesn't works
Because can't find the main class, it's really rare
e
You should figure out what's going on there instead. Did you try creating a package level main function and run it as a normal Kotlin run configuration instead?
I don't ever use Gradle though, never worked on a gradle based project without running into build or IDE issues, and quite frankly I haven't seen a single advantage over Maven 🙂
s
Yes, and it's working
i'm using gradle because this is a multiplatform project
e
Are you saying it's working when you run it with the normal Kotlin run configuration and a launch statement?
s
The tornado gradle plugin recognize perfectly the main class, but when I run it, nothing happens, let me show you with screenshots
e
I understand that, so I'm asking you to create a normal Kotlin run configuration and launch your app using a standard main function instead
There is probably some gradle incompatibilities with the TornadoFX plugin, never tested it with gradle multi module projects, but I remember there were some issues
s
Yes yes, it works, and also I have more modules (for android for example) and command line, and it's working
My gradle version is 4.7
Which is the command that uses the plugin?
e
So everything is fine when you run it from IDEA, using a main function? Then you should easily be able to start that in debug mode?
s
Let me 1 second, I'll try one thnigng
No, it's not working with
Copy code
fun main(args: Array<String>) {
    Application.launch(FibraApp::class.java, *args)
}
jmmmmm
e
Sorry, I'm confused.. What was actually working then? Only when running from the gradle command line?
By the way, you can write that as
launch<FibraApp>(args)
s
Yes sorry, I explanied badly
e
OK, I see. What's the error message you get when you run the main function?
If the main function doesn't work, there is no way the plugin would work either, so we need to figure that out first.
s
`gradlew desktop:run`👌
FibraApp build config
Running from main
bot gets -> Class 'com.sergiocasero.desktop.app.FibraAppKt' not found in module 'desktop'
e
Is FibraApp in module desktop? Also, is it correctly compiled and placed in the target folder?
You could try to run Build -> Rebuild Project and then run the main function
s
Yes yes, 100% sure, I'm suspecting that could be because they are under
src/main/kotlin
Instead of
src/main/java
e
Where the source files are doesn't matter at runtime
s
I'm rebuilding
e
If this doesn't work. Is the project open source? Can I try to run it somehow?
Or even better yet - maybe you could set up a minimal sample project?
s
This is not OpenSource, but I have another project with the same issue: https://github.com/sergiocasero/votlin-app/tree/feature/desktop
e
OK! Heading out for lunch, will take a look soon!
Looks like I'm not alone
e
OK, so it doesn't seem to be TornadoFX/JavaFX related even. Not sure I'd be the best to debug this then, seeing as I have very little Gradle experience, and quite frankly loathe the thing.. hehe 🙂 Check if there is an issue for this over at JetBrains, or file one perhaps?
s
I've also ask on MPP channel
Because yes, looks like it's not related with Tornado
Thanks for your time 😞
@edvin right now looks like it's working:
Copy code
dic 28, 2018 1:31:13 PM tornadofx.FX$Companion replaceComponent
INFORMACIÓN: Reloaded [Scene] com.sergiocasero.desktop.app.RootView@2e74ae7
But I can't see the changes 🤔
e
@Sergio Casero Are you running in debug mode, and are you recompiling?
s
Yes, and yes. But no worries, If I restart the app it takes only few seconds so there is no problem 🙂