首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用带有wro4j-maven- theme.less的Twitter Bootstrap插件

使用带有wro4j-maven- theme.less的Twitter Bootstrap插件
EN

Stack Overflow用户
提问于 2014-09-10 11:23:47
回答 1查看 904关注 0票数 1

由于某些原因,我无法使用wro4j构建/编译theme.less (来自Bootstrap 3.2.0)。我在Maven插件输出中得到了许多错误,例如:

代码语言:javascript
复制
[INFO] processing group: bootstrap-theme.css
2487 ERROR Less4jProcessor      - Failed to compile less resource: ro.isdc.wro.model.resource.Resource@53bb87b9[CSS,bootstrap-theme,true].
2487 ERROR Less4jProcessor      - 2069:13 no viable alternative at input '>' in ruleset (which started at 2068:1).
2487 ERROR Less4jProcessor      - 2069:25 mismatched input '@start-color' expecting '~'<escaped value>'' in selectors (which started at 2069:3).
2487 ERROR Less4jProcessor      - 2069:25 no viable alternative at input '@start-color' in ruleset (which started at 2069:3).
2487 ERROR Less4jProcessor      - 2069:46 no viable alternative at input '@progress-bg' in selectors (which started at 2069:37).

由于CSS导入,行号没有用,但它们看起来与theme.less文件中的一些引用相对应。

wro.properties

代码语言:javascript
复制
preProcessors=cssImport,semicolonAppender   
postProcessors=less4j,cssMinJawr

wro.xml

代码语言:javascript
复制
<groups xmlns="http://www.isdc.ro/wro">
    <!-- This file configures the Web Resource Optimizer for Java (wro4j). This 
        tool minifies JS, compiles LESS CSS, etc. See https://code.google.com/p/wro4j/ 
        and https://github.com/jbosstools/m2e-wro4j/wiki/Sample-twitter-bootstrap-project 
        for details. -->
    <group name="bootstrap">
        <css>/bootstrap-3.2.0/less/bootstrap.less</css>
        <js>/bootstrap-3.2.0/js/*.js</js>
    </group>
    <group name="bootstrap-theme">
        <css>/bootstrap-3.2.0/less/theme.less</css>
    </group>
</groups>

pom.xml

代码语言:javascript
复制
<plugin>
    <!-- Run the Web Resource Optimizer for Java (wro4j) as part of the build. 
        This tool minifies JS, compiles LESS CSS, etc. See https://code.google.com/p/wro4j/ 
        and https://github.com/jbosstools/m2e-wro4j/wiki/Sample-twitter-bootstrap-project 
        for details. -->
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-maven-plugin</artifactId>
    <version>1.7.6</version>
    <configuration>
        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
        <!-- <targetGroups>bootstrap</targetGroups> -->
        <!-- Search for resources in both the source and output trees, to ensure 
            that generated resources are also found. -->
        <contextFolder>${basedir}/src/main/webapp/,${project.build.directory}</contextFolder>
        <destinationFolder>${project.build.outputDirectory}/${project.build.finalName}</destinationFolder>
        <cssDestinationFolder>${project.build.directory}/${project.build.finalName}/WEB-INF/resources/css</cssDestinationFolder>
        <jsDestinationFolder>${project.build.directory}/${project.build.finalName}/WEB-INF/resources/js</jsDestinationFolder>
    </configuration>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

恐怕我在这里已经没有主意了。普通的bootstrap.less构建得很好--只是主题看起来不太好。

EN

回答 1

Stack Overflow用户

发布于 2014-09-11 20:42:18

这是less4j中的一个错误,维护者已经非常友好地修复了它。更新到新的less4j 1.8.2版本可以解决此问题:

代码语言:javascript
复制
<plugin>
    <!-- Run the Web Resource Optimizer for Java (wro4j) as part of the build. 
        This tool minifies JS, compiles LESS CSS, etc. See https://code.google.com/p/wro4j/ 
        and https://github.com/jbosstools/m2e-wro4j/wiki/Sample-twitter-bootstrap-project 
        for details. -->
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-maven-plugin</artifactId>
    <version>1.7.6</version>
    <configuration>
        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
        <!-- <targetGroups>bootstrap</targetGroups> -->
        <!-- Search for resources in both the source and output trees, to ensure 
            that generated resources are also found. -->
        <contextFolder>${basedir}/src/main/webapp/,${project.build.directory}</contextFolder>
        <destinationFolder>${project.build.outputDirectory}/${project.build.finalName}</destinationFolder>
        <cssDestinationFolder>${project.build.directory}/${project.build.finalName}/WEB-INF/resources/css</cssDestinationFolder>
        <jsDestinationFolder>${project.build.directory}/${project.build.finalName}/WEB-INF/resources/js</jsDestinationFolder>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>com.github.sommeri</groupId>
            <artifactId>less4j</artifactId>
            <version>1.8.2</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25756829

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档