 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

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

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

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

      plugins:
        options:
          bare: false
        expand: true
        cwd: 'src/plugins'
        src: '*.coffee'
        dest: 'compiled/plugins/'
        ext: '.js'

    uglify:
      options:
