michael-simons/wro4j-spring-boot-starter

sass less

Closed this issue · 1 comments

Hello,

thanks a lot for this starter...

how enable sassCss and lessCss, its possible?

tks

Hi @sheldonchaves

This is pretty easy todo actually.

First, you have to add the wro4-extension to the dependencies. I have excluded them from the starter on purpose because the bring a lot of stuff with them:

inside pom.xml

<dependency>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-extensions</artifactId>
    <version>1.8.0</version>
</dependency>

Then, in your application.properties add the following processors (and all others you might need)

wro4j.managerFactory.preProcessors=cssUrlRewriting, cssImport
wro4j.managerFactory.postProcessors=rubySassCss, cssMin

I have added the cssUrlRewriting, cssImport to allow easy resolving of SCSS partials.

Then, in wro.xml, build your groups as usual

<groups xmlns="http://www.isdc.ro/wro">
    <group name="demo">
        <css>/base.scss</css>
        <css>/nav.scss</css>
    </group>
</groups>

Thos two scss files are part of the attached demo: wro4jscssdemo.zip, including the setting above.

You can extract and run it with ./mvnw spring-boot:run and hit http://localhost:8080 and see the results.