diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..6db14d5 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,53 @@ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + concat: { + options: { + separator: '\n\n', + stripBanners: true, + banner: '// <%= pkg.name %> <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n' + }, + dist: { + src: "src/*.js", + dest: 'build/<%= pkg.name %>.js' + } + }, + uglify: { + options: { + stripBanners: true, + banner: '// <%= pkg.name %> <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n' + }, + build: { + src: 'build/<%= pkg.name %>.js', + dest: 'build/<%= pkg.name %>.min.js' + } + }, + jshint: { + files: 'src/knockout-postbox.js', + options: { + //"-W030": false, + force: true + } + }, + watch: { + scripts: { + files: ['src/*.*'], + tasks: ['default'], + options: { + nospawn: true + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + + // Default task(s). + grunt.registerTask('default', ['jshint', 'concat', 'uglify']); + +}; \ No newline at end of file diff --git a/README.md b/README.md index ae1135a..a567afa 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ Dependencies Build ----- -This project uses anvil.js (see http://github.com/arobson/anvil.js) for building/minifying. +This project uses [grunt](http://gruntjs.com/) for building/minifying. Install from NuGet ------------------ diff --git a/build.json b/build.json deleted file mode 100644 index 764d6b6..0000000 --- a/build.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "source": "src", - "output": "build", - "spec": "spec", - "anvil.uglify" : { - "all": true - }, - "anvil.http": { - "paths": { - "/ext": "./ext", - "/examples": "./examples", - "/build": "./build" - } - }, - "dependencies" : [ "anvil.http", "anvil.uglify"] -} \ No newline at end of file diff --git a/build/knockout-postbox.js b/build/knockout-postbox.js index 431fe9c..e9eb36b 100644 --- a/build/knockout-postbox.js +++ b/build/knockout-postbox.js @@ -1,5 +1,5 @@ -//knockout-postbox 0.3.1 | (c) 2013 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license -!(function(factory) { +// knockout-postbox 0.3.1 | (c) 2013 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license +;(function(factory) { //CommonJS if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { factory(require("knockout"), exports); diff --git a/build/knockout-postbox.min.js b/build/knockout-postbox.min.js index faca6ff..d0ab89a 100644 --- a/build/knockout-postbox.min.js +++ b/build/knockout-postbox.min.js @@ -1,2 +1,2 @@ -//knockout-postbox 0.3.1 | (c) 2013 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license -!function(e){typeof require=="function"&&typeof exports=="object"&&typeof module=="object"?e(require("knockout"),exports):typeof define=="function"&&define.amd?define(["knockout","exports"],e):e(ko,ko.postbox={})}(function(e,t,n){var r,i;e.subscribable.call(t),t.topicCache={},t.serializer=e.toJSON,t.publish=function(e,n){e&&(t.topicCache[e]={value:n,serialized:t.serializer(n)},t.notifySubscribers(n,e))},i=t.subscribe,t.subscribe=function(e,n,r){if(e)return i.call(t,n,r,e)},t.defaultComparer=function(e,n){return n&&t.serializer(e)===n.serialized},e.subscribable.fn.publishOn=function(e,n,i){var s;return e&&(typeof n=="function"?i=n:s=n,i=i||t.defaultComparer,r.call(this,e,"publishOn"),this.postboxSubs[e].publishOn=this.subscribe(function(n){i.call(this,n,t.topicCache[e])||t.publish(e,n)},this),s||t.publish(e,this())),this},r=function(e,t){var n=this.postboxSubs=this.postboxSubs||{};n[e]=n[e]||{},n[e][t]&&n[e][t].dispose()},e.subscribable.fn.stopPublishingOn=function(e){return r.call(this,e,"publishOn"),this},e.subscribable.fn.subscribeTo=function(i,s,o){var u,a,f,l=this;return typeof s=="function"?o=s:u=s,i&&e.isWriteableObservable(this)&&(r.call(this,i,"subscribeTo"),f=function(e){l(o?o.call(l,e):e)},this.postboxSubs[i].subscribeTo=t.subscribe(i,f),u&&(a=t.topicCache[i],a!==n&&f(a.value))),this},e.subscribable.fn.unsubscribeFrom=function(e){return r.call(this,e,"subscribeTo"),this},e.subscribable.fn.syncWith=function(e,t,n,r){return this.subscribeTo(e,t).publishOn(e,n,r),this},e.postbox=t}) \ No newline at end of file +// knockout-postbox 0.3.1 | (c) 2013 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license +!function(a){"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?a(require("knockout"),exports):"function"==typeof define&&define.amd?define(["knockout","exports"],a):a(ko,ko.postbox={})}(function(a,b,c){var d,e;a.subscribable.call(b),b.topicCache={},b.serializer=a.toJSON,b.publish=function(a,c){a&&(b.topicCache[a]={value:c,serialized:b.serializer(c)},b.notifySubscribers(c,a))},e=b.subscribe,b.subscribe=function(a,c,d){return a?e.call(b,c,d,a):void 0},b.defaultComparer=function(a,c){return c&&b.serializer(a)===c.serialized},a.subscribable.fn.publishOn=function(a,c,e){var f;return a&&("function"==typeof c?e=c:f=c,e=e||b.defaultComparer,d.call(this,a,"publishOn"),this.postboxSubs[a].publishOn=this.subscribe(function(c){e.call(this,c,b.topicCache[a])||b.publish(a,c)},this),f||b.publish(a,this())),this},d=function(a,b){var c=this.postboxSubs=this.postboxSubs||{};c[a]=c[a]||{},c[a][b]&&c[a][b].dispose()},a.subscribable.fn.stopPublishingOn=function(a){return d.call(this,a,"publishOn"),this},a.subscribable.fn.subscribeTo=function(e,f,g){var h,i,j,k=this;return"function"==typeof f?g=f:h=f,e&&a.isWriteableObservable(this)&&(d.call(this,e,"subscribeTo"),j=function(a){k(g?g.call(k,a):a)},this.postboxSubs[e].subscribeTo=b.subscribe(e,j),h&&(i=b.topicCache[e],i!==c&&j(i.value))),this},a.subscribable.fn.unsubscribeFrom=function(a){return d.call(this,a,"subscribeTo"),this},a.subscribable.fn.syncWith=function(a,b,c,d){return this.subscribeTo(a,b).publishOn(a,c,d),this},a.postbox=b}); \ No newline at end of file diff --git a/header.js b/header.js deleted file mode 100644 index 352c7e2..0000000 --- a/header.js +++ /dev/null @@ -1 +0,0 @@ -//knockout-postbox 0.3.1 | (c) 2013 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..80c4cf6 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "knockout-postbox", + "version": "0.3.1", + "devDependencies": { + "grunt": "~0.4.1", + "grunt-contrib-uglify": "0.x.x", + "grunt-contrib-jshint": "0.x.x", + "grunt-contrib-watch": "0.x.x", + "grunt-contrib-concat": "0.x.x" + } +} diff --git a/src/knockout-postbox.js b/src/knockout-postbox.js index 5beef79..e8ef98d 100644 --- a/src/knockout-postbox.js +++ b/src/knockout-postbox.js @@ -1,4 +1,4 @@ -!(function(factory) { +;(function(factory) { //CommonJS if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { factory(require("knockout"), exports);