使用Compass和SASS Maven插件生成精灵图时缺少加载路径。

3

我正在尝试使用sass-maven-plugin,其中有一个useCompass选项。我想将目录中的图像合并成精灵图片,但是我无法让该目录被“看到”。我一直收到的错误是说匹配icons/*.png的加载路径找不到任何文件。请参见下面的完整错误信息。

注意:如果我只使用compass compile从命令行运行它,则可以正常工作。但是使用maven目标运行它仍然会出现错误。

pom.xml
|-src
 |-main
   |-scss
     |-styleguide
          -styleguide.scss
     |-images
       |-icons
          -my.png

pom.xml

<plugin>
    <groupId>org.jasig.maven</groupId>
    <artifactId>sass-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>sassProcessResources</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>update-stylesheets</goal>
            </goals>
            <configuration>
                <useCompass>true</useCompass>
                <sassSourceDirectory>${basedir}/src/main/scss</sassSourceDirectory>
                <destination>${project.build.outputDirectory}/styleguide-components/resources/css</destination>
            </configuration>
        </execution>
    </executions>
</plugin>

SCSS文件

@import "icons/*.png";

错误

Compilation of template C:/code/DiscoveryStyleGuide/styleguide/src/main/scss/styleguide/sprite/Sprite.scss failed: No files were found in the load path matching "icons/*.png". Your current load paths are: ./images

config.rb

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "compiled"
sass_dir = "/"
images_dir = "images"
# javascripts_dir = "javascripts"

你的config.rb文件里有什么内容? - cimmanon
我创建了一个 config.rb 文件,并成功让构建程序读取它,但还是存在问题。我将尝试处理路径以确定相对位置。 - zmanc
@zmanc,你能解释一下你是如何让构建读取它的吗? - qkrijger
我使用下面的提交记录拉取了包含代码的构建。 - zmanc
相对于pom.xml,config.rb应该放在哪里? - Daniel Hári
丹尼尔,我把它放在与pom相同的级别上。 - zmanc
1个回答

0

这实际上是指南针中的一个错误。由@scottdavis通过以下提交进行了修复此提交


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接