 module.exports = (grunt) ->
   ENV = grunt.option("env") or process.env.GRUNT_ENV or 'development'
+
+  plugins_hashes_mapping = ->
+    compiled_assets = grunt.file.readJSON('compiled/assets.json')
+    plugins = {}
+    for k,v of compiled_assets
+      if(/^js\/plugins\//.test(k))
+        plugin = if ENV isnt 'development' then v.replace('.js', '.min.js') else v
+        plugins["#{k.substring(k.lastIndexOf('js/plugins/')+11, k.lastIndexOf('.js'))}_hash"] = plugin
+    plugins
 
   grunt.initConfig
     env: ENV

        src: [
          '**/*.coffee'
          '!loader.coffee'
        ]
        dest: 'compiled/'
        ext: '.js'

    clean:
      payload:
        src: ['dist/js/payload*']
      plugins:
        src: ['dist/js/plugins/*']

    environment:
      src: './config/settings/'
