icebeat/webwriter — pull request #6 by ninjabiscuit (2013-06-08 18:36:59+00:00)
Title: Use Grunt to create concatenated and minified files for distribution

I'm really glad that someone has taken the time to replicate iA writer in the browser - so thanks for that!

However, I'd really like to be able to include just one file instead of all the individual files that make up this project. I'd also like to use the AMD pattern to include this file in my project.

In this pull request I've added grunt to the project along with grunt-rigger, grunt-contrib-uglify and grunt-contrib-watch.

Run `npm install` to grab all the new dev dependencies.

I've moved the files that were previously in the js folder and moved them into a src folder. Running the `grunt` task will build the file into a single concatenated file and also an minified version of that file.

Running `grunt watch` will update the distribution files every time a change is made to the src files.

I also wrapped a self executing anonymous function around the concatenated file to protect the global namespace from all the variables.

Finally, I added a conditional define wrapper around the Editor constructor. This only happens if define is available in the page (if require or any other AMD package are available). If define is not... defined... the Editor constructor gets exposed to the global namespace.

What do you think?