指南针无法找到用于创建精灵的图像

时间:2015-05-13 15:09:19

标签: sass compass-sass compass

在Gruntfile.js中:

compass: {
  options: {
    sassDir: '<%= yeoman.app %>/styles',
    cssDir: '.tmp/styles',
    generatedImagesDir: '.tmp/images/generated',
    imagesDir: '<%= yeoman.app %>/images',
    javascriptsDir: '<%= yeoman.app %>/scripts',
    fontsDir: '<%= yeoman.app %>/styles/fonts',
    importPath: '<%= yeoman.app %>/bower_components',
    httpImagesPath: '../images',
    httpGeneratedImagesPath: '../images/generated',
    httpFontsPath: '/styles/fonts',
    spriteLoadPath: '<%= yeoman.app %>/styles/sprites/',
    relativeAssets: true,
    assetCacheBuster: false
  },
  dist: {
    options: {
      generatedImagesDir: '<%= yeoman.dist %>/images/generated'
    }
  },
  server: {
    options: {
      debugInfo: false
    }
  }
},

这是任务:

 compass: {
              files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
              tasks: ['compass:server', 'autoprefixer']
              },

当我运行我的grunt任务时,会收到此错误:

  

错误app / styles / main.scss(第9行:在匹配“app / styles / sprites / icons / * .png”的加载路径中找不到文件。。您当前的加载路径是:app / styles / sprites / ,/ Volumes / myuser / Documents / Projects / mysite / app / images)

main.scss第9行:

@import "app/styles/sprites/icons/*.png";

为什么指南针没有找到任何图像?

1 个答案:

答案 0 :(得分:1)

只需将导入更改为

即可
@import "icons/*.png";

您当前的加载路径(在罗盘中)已指向:app/styles/sprites/