{"id":21678283,"url":"https://github.com/base-apps/base-apps-router","last_synced_at":"2025-07-15T01:07:49.183Z","repository":{"id":57178457,"uuid":"65414909","full_name":"base-apps/base-apps-router","owner":"base-apps","description":"A community-driven fork of https://github.com/zurb/front-router","archived":false,"fork":false,"pushed_at":"2017-10-05T11:28:25.000Z","size":42,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-13T04:50:38.022Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/base-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-10T20:38:59.000Z","updated_at":"2019-10-28T23:05:05.000Z","dependencies_parsed_at":"2022-09-14T02:31:16.357Z","dependency_job_id":null,"html_url":"https://github.com/base-apps/base-apps-router","commit_stats":null,"previous_names":["base-apps/angular-front-router"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/base-apps/base-apps-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-apps%2Fbase-apps-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-apps%2Fbase-apps-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-apps%2Fbase-apps-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-apps%2Fbase-apps-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/base-apps","download_url":"https://codeload.github.com/base-apps/base-apps-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-apps%2Fbase-apps-router/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265108365,"owners_count":23712460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T14:27:39.652Z","updated_at":"2025-07-15T01:07:49.119Z","avatar_url":"https://github.com/base-apps.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Base Apps Router\n\nAn open source, community-driven fork of [Front Router by Zurb](https://github.com/zurb/front-router).\n\n[![Build Status](https://travis-ci.org/base-apps/base-apps-router.svg)](https://travis-ci.org/base-apps/base-apps-router)\n[![GitHub version](https://badge.fury.io/gh/base-apps%2Fbase-apps-router.svg)](https://badge.fury.io/gh/base-apps%2Fbase-apps-router)\n\nBase Apps Router simplifies the creation of routes in AngularJS by allowing you to define them directly in your view templates.\n\nState settings are defined in a [Front Matter](http://jekyllrb.com/docs/frontmatter/) block at the top of each template.\n\n```html\n---\nname: post\nurl: /post/:id\ncontroller: PostController\n---\n\n\u003ch1\u003ePost\u003c/h1\u003e\n```\n\nBase Apps Router parses each file, removing the Front Matter from the HTML and storing it in a JavaScript object of states. This object is saved as a new JavaScript file, which can be read by another library and converted into actual routes.\n\nThis library was developed for use with [Angular Base Apps](https://github.com/base-apps/angular-base-apps), a responsive web app framework from [Base Apps](https://github.com/base-apps), to simplify the process of prototyping single-page web apps.\n\n## Install\n\nGet started by installing base-apps-router from npm.\n\n```bash\nnpm install base-apps-router --save\n```\n\n## Usage\n\nBase Apps Router is a plugin that takes in HTML files, removes the Front Matter, and returns the modified file. On completion, the route data is written to disk as a new file.\n\nThe plugin can be used standalone:\n```js\nvar router = require('base-apps-router');\n\nrouter({\n  src: './src/templates/**/*.html',\n  dest: './build/templates'\n  path: './build/js/routes.js',\n  root: './src/templates'\n}).then(function() {\n  console.log(\"Base Apps Router complete!\");\n});\n```\n\nOr as part of a Gulp stream:\n```js\nvar gulp = require('gulp');\nvar router = require('base-apps-router');\n\ngulp.src('./src/templates/**/*.html')\n  .pipe(router({\n    path: './build/js/routes.js',\n    root: './src/templates'\n  }))\n  .pipe(gulp.dest('./build/templates'));\n```\n\nBase Apps Router accepts the following parameters:\n\n  - **src** (String): Glob of HTML files to parse. Not used in a Gulp context.\n  - **dest** (String): Folder to output HTML files to. Not used in a Gulp context.\n    - If not provided, output of HTML files will be skipped.\n  - **root** (String): Common path to source HTML files.\n  - **path** (String): File path for JavaScript routes file.\n  - **overwrite** (String): Whether or not to overwrite the routes file (appends by default).\n  - **library** (String): Library to format routes file for.\n    - Values: default, angular, node\n\n## Libraries\n\nThe following libraries are supported\n\n### default\n\nIf no library is provided, the route configuration will be output to the global variable `BaseAppsRoutes`.\n\n### angular\n\nUse in combination with [Angular Dynamic Routing](https://github.com/base-apps/angular-dynamic-routing) to produce `ui-router` states for angular from the route configurations.  The `BaseAppsState` service provided by the `dynamicRouting` module will be used to configure the routes.\n\n### node\n\nExports routes as a node module using `module.exports`.\n\n## Front Matter Parameters\n\n### name\n\n**Required.** The name of the view. Refer to this when using `ui-sref` to link between views.\n\n```\n---\nname: home\nurl: /\n---\n```\n\nThe `name` parameter can also use ui-router's dot notation to indicate a child view.\n\n```\n---\nname: home.child\nurl: /child\n---\n```\n\n### url\n\n**Required.** Defines the URL at which a page can be directly accessed.\n\n```\n---\nname: home\nurl: /\n---\n```\n\nWhen setting up a child view, don't include the segment of the URL for the parent view\u0026mdash;it will be inserted automatically.\n\n```\n---\nname: parent.child\nurl: /child\n---\n```\n\n In the above example, the final URL is `/parent/child`, assuming the URL of the parent view is `/parent`.\n\n A URL can also contain parameters, which will be passed to the view's controller when it loads. Learn more about URL parameters on [ui-router's](https://github.com/angular-ui/ui-router/wiki/URL-Routing#url-parameters) documentation.\n\n```\n---\nname: post\nurl: /post/:id\n---\n```\n\n### animationIn\n\nSets a transition to play when the view animates in. Refer to the \u003ca ui-sref=\"motion-ui\"\u003eMotion UI\u003c/a\u003e documentation to see the list of built-in transitions.\n\n```\n---\nname: home\nurl: /\nanimationIn: slideInRight\n---\n```\n\n### animationOut\n\nSets a transition to play when the view animates out. Refer to the [Motion UI](https://github.com/base-apps/angular-base-apps) documentation to see the list of built-in transitions.\n\n```\n---\nname: home\nurl: /\nanimationIn: fadeIn\nanimationOut: fadeOut\n---\n```\n\n### parent\n\nDefines the parent view for the current one. You can use this as an alternative to the `parent.child` syntax.\n\n```\n----\nname: child\nparent: parent\nurl: /child\n----\n```\n\n### controller\n\nBy default, all views use a controller called `DefaultController`, but this can be changed.\n\n```\n---\nname: home\nurl: /\ncontroller: HomeController\n---\n```\n\nAmong other things, the default controller passes a bunch of data through. For instance, all of your front-matter settings will be accessible via `vars` in your template. `{{ vars.name }}` will return the name of your route while `{{ vars.path }}` will return the relative path to the template.\n\nNote that override a controller disables front-matter settings (except dynamic routing). If you want to use your own controller AND keep this feature, you can extend the `DefaultController`:\u003c/p\u003e\n\n```javascript\nangular.module('application')\n    .controller('MyController', MyController)\n;\n\nMyController.$inject = ['$scope', '$stateParams', '$state', '$controller'];\n\nfunction MyController($scope, $stateParams, $state, $controller) {\n  angular.extend(this, $controller('DefaultController', {\n    $scope: $scope,\n    $stateParams: $stateParams,\n    $state: $state\n  }));\n  // Your code...\n}\n```\n\n### abstract\n\nDefines a state as abstract. Abstract states can have child states, but can't be navigated to directly. Check out the [ui-router documentation](https://github.com/angular-ui/ui-router/wiki/Nested-States-%26-Nested-Views#abstract-states) to learn more.\n\n```\n---\nname: home\nurl: /\nabstract: true\n---\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase-apps%2Fbase-apps-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbase-apps%2Fbase-apps-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase-apps%2Fbase-apps-router/lists"}