Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Codename One CSS

Tags:

codenameone

Is it possible to use more CSSes in the same Codename One project?

Use case 1: I want different styles in different parts of the app or I want to replace at all the current styling.

Use case 2: I want that the current style is derived from several CSSes, like in a web page

like image 737
Francesco Galgani Avatar asked Oct 17 '22 10:10

Francesco Galgani


1 Answers

There is currently no support for that in the CSS implementation that's integrated into the plugin. The old implementation allowed that but we simplified some things so the conversion process will be fluid.

Since multiple resource files and layered themes are supported internally by Codename One this should probably be easy to accomplish. I'm guessing something like this in the build.xml might work:

<target name="-cn1-compile-css" if="codename1.cssTheme">
        <java jar="${user.home}/.codenameone/designer_1.jar" failonerror="true">
            <jvmarg value="-Dcli=true"/>
            <arg value="-css"/>
            <arg file="css/theme.css"/>
            <arg file="src/theme.res"/>
        </java>
        <java jar="${user.home}/.codenameone/designer_1.jar" failonerror="true">
            <jvmarg value="-Dcli=true"/>
            <arg value="-css"/>
            <arg file="css/second-theme.css"/>
            <arg file="src/second-theme.res"/>
        </java>
    </target>
</project>
like image 167
Shai Almog Avatar answered Nov 02 '22 12:11

Shai Almog