diff --git a/.gitignore b/.gitignore index f053ce4..86167d3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ hooks/pre-rebase.sample hooks/prepare-commit-msg.sample hooks/update.sample info/exclude +*.iml +*.ipr .idea .grunt .istanbul diff --git a/Gruntfile.js b/Gruntfile.js index f12f065..7fc8959 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -54,5 +54,5 @@ module.exports = function ( grunt ) { grunt.registerTask( 'lint', ['jshint'] ); grunt.registerTask( 'travis', ['jshint', 'connect', 'jasmine'] ); - grunt.registerTask( 'default', ['jshint', 'connect', 'jasmine'] ); + grunt.registerTask( 'default', ['jshint', 'uglify', 'connect', 'jasmine'] ); }; diff --git a/README.md b/README.md index 98e8e75..ba24109 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ The module would then have its own SubRoute which would have its own mappings fo This project is based on [a Gist by Tim Branyen](https:gist.github.com/1235317), and [used with permission](https://gist.github.com/1235317/74bf2745515d902e0bfc87bd8e95e94c93362915#gistcomment-234230) from the original author. +Subroute is lightweight, weighing in at under 300 bytes minified and gzipped. + ## Downloads *Latest Stable Release: 0.4.0* diff --git a/dist/backbone.subroute.min.js b/dist/backbone.subroute.min.js index 6fbd5c7..4e0da31 100644 --- a/dist/backbone.subroute.min.js +++ b/dist/backbone.subroute.min.js @@ -1 +1 @@ -!function(a){"function"==typeof define&&define.amd?define(["underscore","backbone"],a):a(_,Backbone)}(function(a,b){return b.SubRoute=b.Router.extend({constructor:function(a,c){this.prefix=a=a||"",this.separator="/"===a.slice(-1)?"":"/",this.createTrailingSlashRoutes=c&&c.createTrailingSlashRoutes,b.Router.prototype.constructor.call(this,c);var d;d=b.history.fragment?b.history.getFragment():b.history.getHash(),0===d.indexOf(a)&&b.history.loadUrl(d),this.postInitialize&&this.postInitialize(c)},navigate:function(a,c){"/"!=a.substr(0,1)&&0!=a.indexOf(this.prefix.substr(0,this.prefix.length-1))&&(a=this.prefix+(a?this.separator:"")+a),b.Router.prototype.navigate.call(this,a,c)},route:function(a,c,d){"/"===a.substr(0)&&(a=a.substr(1,a.length));var e=this.prefix;return a&&a.length>0&&(e+=this.separator+a),this.createTrailingSlashRoutes&&(this.routes[e+"/"]=c,b.Router.prototype.route.call(this,e+"/",c,d)),this.routes[e]=c,b.Router.prototype.route.call(this,e,c,d)}}),b.SubRoute}); \ No newline at end of file +!function(a){"function"==typeof define&&define.amd?define(["underscore","backbone"],a):a(_,Backbone)}(function(a,b){return b.SubRoute=b.Router.extend({constructor:function(c,d){this.prefix=c=c||"",this.separator="/"===c.slice(-1)?"":"/",this.createTrailingSlashRoutes=d&&d.createTrailingSlashRoutes,b.Router.prototype.constructor.call(this,d);var e;e=b.history.fragment?b.history.getFragment():b.history.getHash(),a.every(this.routes,function(a,c){return e.match(b.Router.prototype._routeToRegExp(c))?(b.history.loadUrl(e),!1):!0},this),this.postInitialize&&this.postInitialize(d)},navigate:function(a,c){"/"!=a.substr(0,1)&&0!==a.indexOf(this.prefix.substr(0,this.prefix.length-1))&&(a=this.prefix+(a?this.separator:"")+a),b.Router.prototype.navigate.call(this,a,c)},route:function(a,c,d){"/"===a.substr(0)&&(a=a.substr(1,a.length));var e=this.prefix;return a&&a.length>0&&(e+=this.separator+a),this.createTrailingSlashRoutes&&(this.routes[e+"/"]=c,b.Router.prototype.route.call(this,e+"/",c,d)),this.routes[e]=c,b.Router.prototype.route.call(this,e,c,d)}}),b.SubRoute}); \ No newline at end of file