找不到Grunt任务默认值

时间:2014-12-12 15:56:11

标签: javascript gruntjs

当我运行命令grunt时,我收到错误:

Warning: Task "default" not found. Use --force to continue.

我的Gruntfile.js:

module.export = function(grunt){
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    sass: {
      dist: {
        files: {
          'dist/flatify.css':'sass/style.scss'
        }
      }
    },
    autoprefixer: {
      dist: {
        files: {
          'dist/dist/flatify.css':'dist/flatify.css'
        }
      }
    },
    cssmin: {
      css: {
        scr: 'dist/flatify.css',
        dest: 'dist/flatify.min.css'
      }
    },
    watch: {
      css:{
        files: '**/*.scss',
        tasks: ['sass','autoprefixer','cssmin:css']
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-autoprefixer');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('default', ['sass','autoprefixer', 'cssmin']);
}

我的package.json:

{
  "name": "Flatify",
  "version": "0.0.1",
  "description": "An beautiful CSS framework",
  "repository": {
    "type": "git",
    "url": "https://github.com/1ClickComputing/Flatify.git"
  },
  "keywords": [
    "CSS"
  ],
  "author": "",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/1ClickComputing/Flatify/issues"
  },
  "homepage": "https://github.com/1ClickComputing/Flatify",
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-autoprefixer": "^2.0.0",
    "grunt-contrib-cssmin": "^0.10.0",
    "grunt-contrib-sass": "^0.8.1",
    "grunt-contrib-uglify": "^0.6.0",
    "grunt-contrib-watch": "^0.6.1"
  }
}

1 个答案:

答案 0 :(得分:1)

Gruntfile中的第一行不正确。应该是:

module.exports = function (grunt)

它错过了exports s