/*
 *	This code was created for Printr B.V. It is open source under the formideos-interface package.
 *	Copyright (c) 2015, All rights reserved, http://printr.nl
 */

module.exports = function (grunt) {
	window = {};

	var json = {
		pkg: grunt.file.readJSON('package.json'),

		/*
		 *	Clean folders before copying.
		 */
		clean: {
			fonts: ['./public/assets/fonts/*'],
			tmp: ['<%= pkg.paths.tmp %>']
		},

		copy: {
			options: {
				noProcess: ['**/*.{eot,woff2,woff,ttf,svg,dae,tga}']
			},
			public: {
				files: [
					{
						expand: true,
						cwd: './bower_components/formide-platform/public',
						src: '**/*',
						dest: 'public/',
						filter: 'isFile'
				    },
				]
			}
		},
	}

	require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks

	grunt.initConfig();
	grunt.config.merge(json);

	/*
	 * Load NPM Plugins
	 */
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-copy');

	/*
	 * Register Tasks
	 */
	grunt.registerTask('build', ['clean:fonts', 'copy:public']);

	grunt.registerTask('default', ['build']);

};
