Removing duplication across Google Stylesheets (GSS) in GWT

71 views Asked by At

Most of my stylesheets (GSS) have the same set of @defmixin statements. I would like to be able to remove the duplication.

Is it possible to @include a common GSS stylesheet in some way? Or are there other ways to do this simply? (I mean without having any external scripting to munge the files.) I'm using GSS from a GWT 2.8 app, by the way.

I found a related question but the answers aren't really appropriate for using GSS within GWT.

2

There are 2 answers

0
ᴇʟᴇvᴀтᴇ On BEST ANSWER

I just found the answer by looking at the GWT code. You can't include files, but you can combine several GSS files by specifying them all in the @Source annotation. E.g.

@Source({"Shared.gss", "BookEditor.gss"})

Hope this helps someone else with the same question.

0
Boris Brudnoy On

To add to the accepted answer, UiBinder templates will likewise allow you to combine GSS files via a comma-separated list, e.g.:

  <ui:style type="com.myapp.client.views.EditorView.Style"
        src="EditorView.gss, ViewCommon.gss"/>

As a result, you'll be able to use definitions from ViewCommon.gss inside EditorView.gss.