使用vaadin 7.3和valo主题编译主题时出错

时间:2014-12-31 04:35:27

标签: java vaadin vaadin7

我正在开发一个使用vaadin v7.2的vaadin应用程序。现在它更新到v7.3.7并使用我的自定义样式的新valo主题。使用mvn clean install编译整个项目时,主题得到完美编译。但是当我尝试使用命令提示符下面的命令

编译主题时
java -cp '../../../../../../target/product-webapp-1.1.3.0-SNAPSHOT/WEB-INF/lib/*' com.vaadin.sass.SassCompiler styles.scss styles.css

它推出了一个未找到的valo错误,如下所示

java.io.FileNotFoundException: Import '../valo/valo.scss' in '/home/lahirub/Documents/PROJECTS/NewClearProduct/newclear-product-webapp/src/main/webapp/VAADIN/themes/mytheme/styles.scss' could not be found

com.vaadin.sass.internal.parser.ParseException: Mixin Definition: valo not found

我的自定义主题就像这样

mytheme.scss

@import "../valo/valo.scss";

@mixin mytheme {
  @include valo;

  // Insert your own theme rules here
}

styles.scss

@import "mytheme.scss";
@import "addons.scss";

// This file prefixes all rules with the theme name to avoid causing conflicts with other themes.
// The actual styles should be defined in mytheme.scss

.mytheme {
  @include addons;
  @include mytheme;

}

addons.scss

/* Import and include this mixin into your project theme to include the addon themes */
@mixin addons {
}

我无法找到此错误的原因。任何人都可以给我一些建议。

2 个答案:

答案 0 :(得分:4)

我刚刚找到了解决方案。需要更换

  <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
            <version>${com.vaadin.version}</version>
            <scope>provided</scope>
        </dependency>

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-client-compiler</artifactId>
    <version>${com.vaadin.version}</version>
    <scope>provided</scope>
</dependency>

在pom.xml中为valo自定义主题。

答案 1 :(得分:1)

在mytheme.scss中,不要忘记在mixin子句之前添加@,否则编译失败。 Liferay的变体可以改变TextField的外观:

// Import valo after setting the parameters
@import "../liferay/liferay.scss";
@import "../valo/valo.scss";


@mixin mytheme {
  @include liferay;
  @include valo;

.v-textfield.height-fix {
    height: 35px;
    border-radius: 4px;
  }
}

我将valo主题直接复制到我的项目中。 styles.scss应该是这样的(即完全相同):

@import "addons.scss";
@import "mytheme.scss";

/* This file prefixes all rules with the theme name to avoid causing conflicts with other themes. */
/* The actual styles should be defined in mytheme.scss */
.mytheme {
    //Your theme's rules go here
  @include addons;
  @include mytheme;
}

对于您的主要问题,为什么编译在包含的valo主题上失败我没有简单的答案。对于Eclipse Mars,Liferay 6.2.4和Vaadin 7.5,此错误(用于全新安装)不会出现。此外,直接复制valo主题到这个实际组合的实际项目已经过时。