使用Compass和Yeoman App

时间:2014-08-29 14:51:39

标签: ruby sass yeoman compass

我使用generator-zf5生成我的Yeoman应用。安装时我说是的,在我的项目中包含Compass,但是我无法在项目文件中看到Compass文件。难道我做错了什么。我需要自己加入吗?如果是这样,怎么样?

我卸载了所有Sass宝石和指南针并重新安装了gem install compass --version 0.12.7,现在正在使用Compass 0.12.7和Sass 3.2.19(Media Mark)。

然后我使用以下方法在本地安装了Compass:

npm install grunt-contrib-compass --save-dev

但是当我向我的CSS添加@include border-radius(25px);时,我一直收到错误消息。谁能帮我?我仍然试图围绕很多这些终端流程喋喋不休。

提前致谢!

2 个答案:

答案 0 :(得分:1)

现在在generator-zf5 github问题跟踪器中解决了它:https://github.com/juliancwirko/generator-zf5/issues/26

答案 1 :(得分:0)

您是否在gruntfile中添加了require选项?

请参阅: http://ericdfields.com/post/installing-compass-frameworks-in-a-yeoman-project

确保你的initConfig中有正确的'watch'块:

grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      ...
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      }, ...

手表下方的罗盘定义:

// Compiles Sass to CSS and generates necessary files if requested
    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: './bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

最后,并发任务定义:

// Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },