重启TomCat时使用sass-maven-plugin编译*.scss文件

Cíc*_*ijó 3 eclipse tomcat sass maven

我将我的pom.xml配置为使用sass-maven-plugin,但我希望每次保存style.scss时都执行编译.使用此配置需要打开Windows终端并运行"maven clean install",并且需要打开此终端以实时编译SCSS文件.

只使用Eclipse可以做到这一点吗?

我项目中的pom.xml就像这样:

<build>
    <plugins>
        <plugin>
            <groupId>org.jasig.maven</groupId>
            <artifactId>sass-maven-plugin</artifactId>
            <version>1.1.1</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>update-stylesheets</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <resources>
                    <resource>
                        <source>
                            <directory>${basedir}/src/main/resources/META-INF/resources/scss</directory>
                        </source>
                        <destination>${basedir}/src/main/resources/META-INF/resources/css</destination>
                    </resource>
                </resources>
                <sassOptions>
                    <cache>false</cache>
                    <always_update>true</always_update>
                </sassOptions>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

Dan*_*ári 5

对于自动编译运行sass-maven-plugin的监视目标:

mvn sass:watch
Run Code Online (Sandbox Code Playgroud)

查看本教程了解更多信息:http://cleancodejava.com/auto-compile-sass-stylesheets-with-maven/