Declaring Variable In JavaFX CSS File

前端 未结 5 1045
悲&欢浪女
悲&欢浪女 2020-12-08 20:10

I\'ve been inspecting the \"caspian.css\" distributed by Oracle in the JavaFX runtime library, and I see they have declared some color values as variables. Eg:



        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 20:50

    In addon for grill2010's solution:
    I recommend to use SCSS with maven's builder (plugin) into CSS in "generate-resources" stage. So, You can use variables with any numbers or colors for any selector.

    I'm using this scenario, and it works fine :)

    P.S. You cannot do that directly in the CSS file for current OpenJFX versions.

               
                    
                    com.github.warmuuh
                    libsass-maven-plugin
                    0.2.10-libsass_3.5.3
                    
                        
                            generate-resources
                            
                                compile
                            
                        
                    
                    
                        ${project.build.directory}/generated-sources/resources
                        ${basedir}/src/main/resources
                        
                        nested
                        false
                        false
                        ${project.build.directory}/generated-sources/resources
                        
                        true
                        false
                        false
                        5
                        true
                        false
                    
                
    
                
                    org.codehaus.mojo
                    build-helper-maven-plugin
                    3.0.0
                    
                        
                            generate-sources
                            
                                add-source
                            
                            
                                
                                    ${project.build.directory}/generated-sources/resources
                                
                            
                        
                    
                
            
    

提交回复
热议问题