3

gruntを使用してsassからcssへのコンパイルを処理できるようにgrunt-contrib-sassを設定しようとしています。基本的なgruntファイルを.でスキャフォールディングした後にインストールしましたgrunt init:makefile。テストのためだけに実行するとgrunt sass、Terminalは「「sass」ターゲットが見つかりません」を返します。

私のセットアップ:

  • $sass-vは「Sass3.2.1」を返します

  • $ruby-vは「ruby1.9.3p194」を返します

  • 'node_modules'フォルダーには'grunt-contrib-sass'が含まれています

  • grunt-contrib-sassのドキュメントに基づくと、私のgrunt.jsファイルは現在次のようになっています。

module.exports = function(grunt) {

grunt.initConfig({
lint: {
  files: ['grunt.js', 'lib/**/*.js', 'test/**/*.js']
},
test: {
  files: ['test/**/*.js']
},
watch: {
  files: '<config:lint.files>',
  tasks: 'lint test'
},
jshint: {
  options: {
    curly: true,
    eqeqeq: true,
    immed: true,
    latedef: true,
    newcap: true,
    noarg: true,
    sub: true,
    undef: true,
    boss: true,
    eqnull: true
  },
  globals: {},
   sass: {                                     // Task
    dist: {                                 // Target
        files: {                            // Dictionary of files
            'main.css': 'main.scss',        // 'destination': 'source'
            'widgets.css': 'widgets.scss'
        }
    },
    dev: {                                  // Another target
        options: {                          // Target options
            style: 'expanded'
        },
        files: {
            'main.css': 'main.scss',
            'widgets.css': [
                'button.scss',
                'tab.scss',
                'debug.scss'                
            ]
        }
    }
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');

grunt.registerTask('default', 'lint sass');

};

ありとあらゆる助けに感謝します...どうもありがとう!

4

1 に答える 1

10

閉じ中括弧を再確認してください。あなたのsassブロックはあなたのブロック内にありますjshint。これを試して:

module.exports = function(grunt) {
grunt.initConfig({
  lint: {
    files: ['grunt.js', 'lib/**/*.js', 'test/**/*.js']
  },
  test: {
    files: ['test/**/*.js']
  },
  watch: {
    files: '<config:lint.files>',
    tasks: 'lint test'
  },
  jshint: {
    options: {
      curly: true,
      eqeqeq: true,
      immed: true,
      latedef: true,
      newcap: true,
      noarg: true,
      sub: true,
      undef: true,
      boss: true,
      eqnull: true
    },
    globals: {},
  },
  sass: {                                   // Task
    dist: {                                 // Target
        files: {                            // Dictionary of files
            'main.css': 'main.scss',        // 'destination': 'source'
            'widgets.css': 'widgets.scss'
        }
    },
    dev: {                                  // Another target
        options: {                          // Target options
            style: 'expanded'
        },
        files: {
            'main.css': 'main.scss',
            'widgets.css': [
                'button.scss',
                'tab.scss',
                'debug.scss'                
            ]
        }
    }
}
});
grunt.loadNpmTasks('grunt-contrib-sass');

grunt.registerTask('default', 'lint sass');

};
于 2012-10-08T22:16:41.077 に答える