1 Reply Latest reply on Jan 7, 2011 12:39 PM by bucpatr1

    Using defaults.css in Ant Build


      I'm working on a project that uses Flex 4 as the client with a java EJB3 backend. I have a custom component in a library that I want to define the default skin for. In flash builder this is no problem, I just create a defaults.css that defines the skin class and add it to the src root of my libaray project. The issue I have is that we use ant build scripts to actually compile and deploy our code to the application server, so I need to be able to tell the build script to include defaults.css into the library swc.


      According to the docs for compc "If you add a stylesheet that references compiled resources such as programmatic skins, use the include-stylesheet option". I tried that, and found out that there actually is no <include-stylesheet>

      available in CompcTask.java so trying to add it to my script would break the build. I Also tried using <include-file> instead, and that at least included the .css file into the compiled library swc, but since my referenced skin class doesn't get compiled in that option really isn't any better.


      Does anyone know of a way to include and compile css files like this without having to compile them into a swf and load at runtime?

        • 1. Re: Using defaults.css in Ant Build
          bucpatr1 Level 2

          After a bit of trial and error I finally got it. To be able to include a defaults.css file via an ant build there are two things you need to include in the build script.

          1)  Inside the opening compc tag, you need to define a value for defaults-css-url that is a string containing the absolute path to your defaults.css file.


          2)  A nested <include-file> tag with the following arguments: name="defaults.css" path=path to defaults.css


          So for example, if your defaults.css file was located in assets/styles the compc segment of the build script would look somethng like this:

          <compc output="${Workspace_Path}/MyLib/bin/myLib.swc"

                        defaults-css-url="${Workspace_Path}/MyLib/assets/styles/defaults.css" >





               <include-file name="defaults.css" path="${Workspace_Path}/MyLib/assets/styles/defaults.css" />