3

Is it possible to have sass compilation on the fly when you run in debug mode using Spring Boot? How? Right now I need to compile it manually every time and developint like this is not really efficient. Is this working for anyone yet?

Thanks a lot in advance for any light on this

Fran

frandevel
  • 747
  • 7
  • 22
  • Haven't used Spring Boot, but any sample project which is by default in debug/development mode compiles the themes on-the-fly without any issue. Have you doublechecked that `productionMode=false` in your `web.xml` or `@VaadinServletConfiguration`? – Morfic Apr 12 '15 at 20:01
  • Thanks for the comment @Morfic, but with Spring boot, this mode and other vaadin parameters are configured in the "application.properties" file. It's set there and still with no effect. I even get the "Vaadin is running in DEBUG MODE" in the logs. So it should be fine – frandevel Apr 14 '15 at 08:25
  • Can you share a sample project to illustrate your issue? I just created a simple project on http://start.spring.io/, made a basic UI with a label & added a theme which changes the text colour, and everything works out of the box. If I modify the colour and refresh the page it immediately picks up the change... – Morfic Apr 14 '15 at 08:53
  • Thanks for the info @Morfic. May I ask how did you create and placed the Theme? Probably my issue is around this. My project was also out of start.spring.io, selecting the web and vaadin options. Then I placed a "VAADIN/themes/mytheme folder" in "src/main/resources", annotated my UI class with "@Theme("mytheme") and started. If I change something on the scss file I need to compile every time and then make the project. – frandevel Apr 15 '15 at 06:48
  • 1
    According to the docs https://vaadin.com/book/-/page/themes.html the themes should be under `src/main/webapp/VAADIN/themes` – Morfic Apr 15 '15 at 06:52
  • I don't know why and what combination did I try to make work, but with placing it, as is, now as you say in "src/main/webapp" it works. Thanks a lot for the tip and for the discussion @Morfic – frandevel Apr 15 '15 at 07:24
  • Same setup for me. Using webapp folder now triggers the on thy fly compilation. But then I get the following error. Any idea what to do? Servlet.service() for servlet [springVaadinServlet] in context with path [] threw exception java.lang.IllegalArgumentException: name – Horst Krause Dec 01 '16 at 14:28

1 Answers1

0

You can add the following lines to your pom.xml, to have sass being compiled to css

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>java</goal>
            </goals>
            <configuration>
                <classpathScope>compile</classpathScope>
                <mainClass>com.vaadin.sass.SassCompiler</mainClass>
                <arguments>
                    <argument>src/main/webapp/VAADIN/themes/heijunka/styles.scss</argument>
                    <argument>src/main/webapp/VAADIN/themes/heijunka/styles.css</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>
Fabri Pautasso
  • 485
  • 6
  • 17