module.exports = (grunt)->
  grunt.initConfig
    stylus:
      editor:
        options:
          urlfunc :'url'
          use : [require('normalize')],
        files:
          'lib/dev/editor.css': "css/index.styl"
    concat:
      core_vendor:
        src:[
          'node_modules/jquery/dist/jquery.js'
          'bower/eventEmitter/EventEmitter.js'
          'bower/eventie/eventie.js'
          'bower/imagesloaded/imagesloaded.js'
          # "bower/es5-shim/es5-shim.min.js",
          # 'bower/jade/runtime.js',
          # "bower/zeroclipboard/ZeroClipboard.min.js",
        ]
        dest:'lib/dev/core.vendor.js'
      vendor:
        src:[
          'node_modules/jquery/dist/jquery.js'
          'bower/jquery.transit/site/jquery.transit-0.9.9.min.js'
          # "node_modules/virtual-dom/dist/virtual-dom.js",
          # "node_modules/jquery-mousewheel/jquery.mousewheel.js",
          "bower/sortable/source/js/jquery-sortable.js"
          # "bower/touch-punch/jquery.touch-punch.js",
          "node_modules/cryptojs/lib/Crypto.js",
          "node_modules/cryptojs/lib/MD5.js",
          "bower/dropbox/index.js"
          "bower/spectrum/spectrum.js"
          # "bower/spin.js/spin.js",
          # "bower/spin.js/jquery.spin.js",
          "bower/tooltips/infotooltip.js"
          # "bower/floatable/floatable.js"
          "bower/nanoscroller/bin/javascripts/jquery.nanoscroller.js"
          "bower/datepickr/src/datepickr.js"
          "bower/clockpicker/dist/jquery-clockpicker.js"
          # "bower/wysihtml5/dist/wysihtml5-0.3.0.min.js"
        ]
        dest:'lib/dev/editor.vendor.js'
    uglify:
      editor:
        files:
          "lib/core.vendor.js"	: ['lib/dev/core.vendor.js']
          "lib/editor.vendor.js" 	: ['lib/dev/editor.vendor.js']
    watch:
      css:
        files: ['css/**/*.styl'],
        tasks: ['stylus']
    copy:
      css:
        files:
          "lib/editor.css": ['lib/dev/editor.css']
    exec:
      build: 'npm run build'
      release: 'npm run release'

  grunt.loadNpmTasks 'grunt-contrib-uglify'
  grunt.loadNpmTasks 'grunt-contrib-stylus'
  grunt.loadNpmTasks 'grunt-contrib-watch'
  grunt.loadNpmTasks 'grunt-contrib-concat'
  grunt.loadNpmTasks 'grunt-copy'
  grunt.loadNpmTasks 'grunt-exec'

  grunt.registerTask 'release',['exec', 'default', 'copy', 'uglify']
  grunt.registerTask 'default',['concat', 'stylus']
