module.exports = (grunt) ->

	# Project configuration.
	grunt.initConfig
		pkg: grunt.file.readJSON('package.json')

		config:
			src: 'assets/coffee'
			dest: 'assets/js'

		clean:
			build:
				src: [  'frontend/web/stylesheet','backend/web/stylesheet' ]
	
		compass:
			frontend:
				options:
					sassDir: 'frontend/web/scss'
					cssDir: 'frontend/web/stylesheet'
			backend:
				options:
					sassDir: 'backend/web/scss'
					cssDir: 'backend/web/stylesheet'
					
		coffee:
			frontend:
				options:
					sourceMap: true
					bare: false
					join: true
				files:
					'frontend/web/js/frontend.js': ['frontend/web/coffee/**/*.coffee']	
			backend:
				options:
					sourceMap: true
					bare: false
					join: true
				files:
					'backend/web/js/backend.js': ['backend/web/coffee/**/*.coffee']
					
		watch:
			options:
				spawn: false
				interrupt: true
				atBegin: true
				interval: 500
			coffeewatch:
        		files: ['frontend/web/coffee/**/*.coffee','backend/web/coffee/**/*.coffee']
        		tasks: ['any-newer:coffee']
			sasswatch:
				files: ['frontend/web/scss/*.scss','backend/web/scss/*.scss']
				tasks: ['compass']	
				
					
	#grunt.loadNpmTasks 'grunt-contrib-compass'

	require('matchdep').filterDev('grunt-*').forEach grunt.loadNpmTasks
	
	# Tasks
	#grunt.registerTask 'default', ['concurrent:compile']
	grunt.registerTask 'default', ['compass','coffee']
	#grunt.registerTask 'production', ['clean', 'concurrent:compile', 'concurrent:optimize']