The ability to import other groocss files is supported by importFile, importStream, and importString methods which take a parameter map and input. Any number of variables can be passed. For example:

    def otherCss = new File('whatever/file.groovy')
    importFile otherCss.absoluteFile, linkColor: '#456789', backColor: 'black'

Within the imported groovy file, linkColor and background will be available with the given values.

For example, given that "file.groovy" has the following contents:

    a { color linkColor backgroundColor backColor }

The resulting CSS would be the following:

    a {
        color #456789;
        background-color: Black;


  • importFile - Takes in a

  • importStream - Takes an InputStream and reads it.

  • importString - Takes a String expected to be a GrooCSS DSL input.

Last updated: 31 July 2019