The gwt-scss-resource is a GWT resource implementation for using SASS/SCSS files as resources in GWT ClientBundles.
For using the scss resource in your gwt project you have to do the following steps:
- add the gwt-scss-resource jar to your gwt classpath. When you use a build tools with depenedencies management you can get it from jcenter
Maven:
<dependency>
<groupId>com.nwalter.gwt</groupId>
<artifactId>gwt-scss-resource</artifactId>
<version>1.2.0</version>
<type>pom</type>
</dependency>
Gradle:
dependencies {
compile 'com.nwalter.gwt:gwt-scss-resource:1.2.0'
}
- add the gwt-scss-resource-module to your module xml
<module>
...
<inherits name="com.nwalter.gwt.scss.ScssResource" />
...
</module>
- use the
ScssResource
interface in your client bundle
public interface MyClientBundle extends ClientBundle {
ScssResource myStyle();
}
You can enable the minification of the resulting css by setting the configuration property scss.minify to true
Example:
<module>
...
<inherits name="com.nwalter.gwt.scss.ScssResource" />
<set-configuration-property name="scss.minify" value="true"/>
...
</module>
For resolving @import
statements in your sass files the compiler will look in the directory of the sass file and on the classpath of the gwt-compiler.
If you want to add additional paths to lookup imports you can add this by annotating the resource method in your client bundle.
Example:
public interface MyClientBundle extends ClientBundle {
@IncludePaths({
"resources/vendor/bootstrap",
"resources/vendor/ui"
})
@Source("style.scss")
ScssResource myStyle();
}