-
Notifications
You must be signed in to change notification settings - Fork 5
Installation
The easiest way to install the CSS library in your Codename One project is to use the command-line installer, which works on Windows, Mac, and Linux and should be compatible with Netbeans, Eclipse, and IntelliJ projects.
$ cd /path/to/cn1-project
$ npm install -g codenameone-cli
$ cn1 css install(If you already have codenameone-cli installed, you can skip the npm install … command).
-
Download latest cn1css-ant-task.jar and copy into your project’s
libdirectory. -
Copy the following snippet into you project’s
build.xmlfile:<taskdef name="compileCSS" classname="com.codename1.ui.css.CN1CSSCompileTask" classpath="lib/cn1css-ant-task.jar"/> <target name="compile-css"> <compileCSS/> </target>
-
Change the following line in your project’s
build.xmlfile:<target name="-pre-compile">
to
<target name="-pre-compile" depends="compile-css">
Now that you have the build script set up to process CSS files, you can add a CSS file to your project and use it in your project. Check out usage instructions for more.
-
Download latest cn1css-ant-task.jar and copy into your project’s
libdirectory. -
Copy the following snippet into you project’s
build.xmlfile:<taskdef name="compileCSS" classname="com.codename1.ui.css.CN1CSSCompileTask" classpath="lib/cn1css-ant-task.jar"/> <target name="compile-css"> <compileCSS/> </target>
-
Change the following line in your project’s
build.xmlfile:<target name="jar">
to
<target name="jar" depends="compile-css">
-
Eclipse doesn’t automatically recognize changes made to files from outside eclipse (like by ANT), so we need to tell it to explicitly synchronize the .res files that will be generated. To that end:
-
Select the
Run>External Tools>External Tools Configurationmenu item. -
Select the "Refresh" tab.
-
Check the "Refresh resources upon completion" box.
-
Select "Specific Resources", then click the "Specify Resources…" button.
-
Select the "src" directory in the file dialog.
-
Now that you have the build script set up to process CSS files, you can add a CSS file to your project and use it in your project. Check out usage instructions for more.