Skip to content
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

Can css be added in the execution of an individual view? #100

Open
nanoclario opened this issue Apr 4, 2019 · 2 comments
Open

Can css be added in the execution of an individual view? #100

nanoclario opened this issue Apr 4, 2019 · 2 comments

Comments

@nanoclario
Copy link

Hello, I would like to know if you can run a view directly and add CSS files in its execution?.
For example:

Tornadofx-plugin

I just want to run a view, to accelerate my development.

But CSS files are only in the main class, and my interface looks like this ...
tornado2

Is there any way to load CSS into the execution configuration for individual views?
.

Due to the desperation, I re-added the css files in my view:

class OperacionView: View("Operaciones"){
   ...
   ..
   .
   init {
        importStylesheet("/css/main.css")
        ...
        ..
        .
        importStylesheet("/css/operacion.css")
    }
    .
    ..
    ...
}

But it's not something I like, since it messes up my code just to try something in development, and I could forget to eliminate it :(

Thanks and regards.

@edvin
Copy link
Owner

edvin commented Apr 4, 2019

There is no support for that unfortunately, though it could quite easily be added to the plugin. To make sure you don't accidentally import stylesheets reduntantly in production, you could pass inn a parameter to the run configuration of your view and check that before calling importStylesheet. For example System.getProperty("force-load-css") or something like that.

If you do this from several views, create a function you can call from your views so that it's reusable, something like forceLoadStylesheets().

@nanoclario
Copy link
Author

Thanks for the recommendation, for now I will use this method, until there is an integration in tornado-idea-plugin :

fun forceLoadStylesheets(){
    if(System.getProperty("sun.java.command").startsWith("tornadofx.App")){
        importStylesheet("/css/main.css")
        importStylesheet("/css/operacion.css")
    }
}

Thanks 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants