我是靠谱客的博主 唠叨发夹,这篇文章主要介绍Gruntfile.coffeeGruntfile.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.coffeeGruntfile.coffee配置文件的全部内容,更多相关Gruntfile内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(126)

评论列表共有 0 条评论

立即
投稿
返回
顶部