Gruntfile.coffee

Gruntfile.coffee配置文件

module.exports = (grunt) ->
  # Project configuration.

  grunt.initConfig
    pkg: grunt.file.readJSON 'package.json'

    coffeelint:
      app: [
        'coffee/**/*.coffee'
        'coffee/*.coffee'
        ]

    coffee:
      dist:
        options:
          sourceMap: false
          bare: true
        files: [
          expand: true
          cwd: 'coffee'
          src: [
            '**/*.coffee'
            '*.coffee'
          ]
          dest: 'build/js'
          ext: '.js'
        ]

    uglify:
      options:
        mangle: false
      build:
        files: [
          expand: true
          cwd: 'build'
          src: [
            '**/*.js'
            '*.js'
          ]
          dest: 'asset'
          ext: '.min.js'
      ]


    sass:
      dist:
        files: [
          expand: true
          cwd: 'scss'
          src: [
            '**/*.scss'
            '*.scss'
          ]
          dest: 'build/css'
          ext: '.css'
      ]

    cssmin:
      build:
        files: [
          expand: true
          cwd: 'build'
          src: [
            '**/*.css'
            '*.js'
          ]
          dest: 'asset'
          ext: '.min.css'
      ]

    clean: dist: 'build'

    watch:
      files: [
        'coffee/**/*.*'
        'coffee/*.*'
        'scss/**/*.*'
        'scss/*.*'
      ]
      tasks: ['coffee', 'uglify', 'sass', 'cssmin', 'clean']
      options: spawn: false

  grunt.loadNpmTasks 'grunt-coffeelint'
  grunt.loadNpmTasks 'grunt-contrib-coffee'
  grunt.loadNpmTasks 'grunt-contrib-uglify'
  grunt.loadNpmTasks 'grunt-contrib-sass'
  grunt.loadNpmTasks 'grunt-contrib-cssmin'
  grunt.loadNpmTasks 'grunt-contrib-watch'
  grunt.loadNpmTasks 'grunt-contrib-clean'

  # Default task(s).
  grunt.registerTask 'default', [
    'coffeelint'
    'coffee:dist'
    'sass:dist'
    'uglify'
    'cssmin'
    'clean:dist'
    'watch'
  ]
  return

你可能感兴趣的:(Gruntfile.coffee)