{"action":"created","comment":{"url":"https://api.github.com/repos/angular/material-tools/pulls/comments/74971406","id":74971406,"diff_hunk":"@@ -0,0 +1,100 @@\n+## Architecture \n+More insight information about the way `material-tools` works.\n+\n+#### Quick Links\n+- [How does it work](#how-does-it-work)\n+- [How to run Angular in NodeJS](#how-to-run-angular-in-nodejs)\n+- [Why are some files manually compiled](#why-are-some-type-of-files-compiled-manually)\n+- [Under-the-Hood: Understanding the Virtual Context](#under-the-hood-understanding-the-virtual-context)\n+- [Under-the-Hood: How to generate a static theme](#under-the-hood-how-to-generate-a-static-theme)\n+\n+### How does it work\n+Material Tools allows developers to build a custom version of [Angular Material 1.x](http://www.github.com/angular/material).\n+\n+As a developer you could just specifiy the given [components](https://github.com/angular/material/tree/master/src/components) \n+and `material-tools` will run Angular Material in the `NodeJS` environment.\n+\n+> Read more about [running an Angular module in NodeJS](#how-to-run-angular-in-nodejs)\n+\n+The tools will then resolve all dependencies of the specified modules and fetch\n+all required files.\n+\n+> Some type of files are going to be manually compiled by tools to have more control about the output.<br/>\n+> Read more [why some files need to be compiled manually](#why-are-some-type-of-files-compiled-manually).\n+\n+At the end all generated output files will be written to a given folder or can be also accessed from NodeJS \n+> Each output file will be also available with `compressed` / `minified` content.\n+\n+![Tools Lifecycle](https://cloud.githubusercontent.com/assets/4987015/17671967/0c55b916-631a-11e6-9d79-d99dd50f630a.png)\n+\n+### How to run Angular in NodeJS\n+\n+To be able to run an Angular module in NodeJS the tools need to mock a browser environment.\n+\n+> Material Tools does only mock the most necessary parts of the browser so the mock is as small as possible.\n+\n+This created mock will then be assigned to the global `window` variable.\n+> The global `window` variable is bound to the NodeJS `globals`, which is shared between all files.\n+\n+This can lead to situations, where the tools are interfering with the user's build process.\n+\n+- The mock is polluting the `globals` of NodeJS.\n+- The NodeJS [module](https://nodejs.org/api/modules.html) cache will be polluted with wrong exports.\n+\n+Read more about the way we solved that issue with the [Virtual Context](#under-the-hood-understanding-the-virtual-context)\n+\n+### Why are some type of files compiled manually\n+\n+Some developers are expecting Material Tools to export the Angular Material stylesheet without the layouts included by default.\n+\n+Since the `core` module of Angular Material always includes the `layouts` by default, we are not able to retrieve the `core` module\n+without the `layouts` included.\n+\n+To work around this issue, we have to manually compile the `core` module with explicitly excluding the `layout` stylesheets.\n+\n+### Under-the-Hood: Understanding the Virtual Context\n+Material Tools places a high value on on the isolation of the modified NodeJS environment.\n+\n+The Virtual Context allows the tools to run specific code completely isolated in \n+another [V8](https://developers.google.com/v8/) context. <br/>\n+It is not only isolating the given code. It also provides a minimalistic NodeJS environment.\n+\n+> It is also possible to require other files from the Virtual Context without leaving the isolated context.<br/>\n+\n+A minimal `require` method has been created inside of the plain V8 context, which supports:\n+- Nesting of the isolated context\n+- Creating / Overwriting context global variables (e.g `window`)\n+- Enabling [strict mode](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Strict_mode)\n+\n+It plays such a big role in Material Tools, because it allows us to completely isolate our changes from the original NodeJS context\n+and also allows us to overwrite the `globals` as mentioned previously.\n+\n+The overwriting of the `globals` is important to be able to run an Angular application in NodeJS.\n+\n+> That's why the Virtual Context is also responsible for mocking the most necessary parts of a browser to run an Angular application.\n+\n+<img src=\"https://cloud.githubusercontent.com/assets/4987015/17678625/2e07fa6a-6338-11e6-9fe6-e6ee54dec53e.png\" height=\"210\">\n+\n+### Under-the-Hood: How to generate a static theme","path":"ARCHITECTURE.md","position":78,"original_position":78,"commit_id":"7732907822457eb8334a9e27c91bcf3db7c5d66a","original_commit_id":"7732907822457eb8334a9e27c91bcf3db7c5d66a","user":{"login":"DevVersion","id":4987015,"avatar_url":"https://avatars.githubusercontent.com/u/4987015?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVersion","html_url":"https://github.com/DevVersion","followers_url":"https://api.github.com/users/DevVersion/followers","following_url":"https://api.github.com/users/DevVersion/following{/other_user}","gists_url":"https://api.github.com/users/DevVersion/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVersion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVersion/subscriptions","organizations_url":"https://api.github.com/users/DevVersion/orgs","repos_url":"https://api.github.com/users/DevVersion/repos","events_url":"https://api.github.com/users/DevVersion/events{/privacy}","received_events_url":"https://api.github.com/users/DevVersion/received_events","type":"User","site_admin":false},"body":"Yeah that makes sense, when making it consistent with the first title :+1: ","created_at":"2016-08-16T16:36:49Z","updated_at":"2016-08-16T16:36:49Z","html_url":"https://github.com/angular/material-tools/pull/18#discussion_r74971406","pull_request_url":"https://api.github.com/repos/angular/material-tools/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/angular/material-tools/pulls/comments/74971406"},"html":{"href":"https://github.com/angular/material-tools/pull/18#discussion_r74971406"},"pull_request":{"href":"https://api.github.com/repos/angular/material-tools/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/angular/material-tools/pulls/18","id":81455302,"html_url":"https://github.com/angular/material-tools/pull/18","diff_url":"https://github.com/angular/material-tools/pull/18.diff","patch_url":"https://github.com/angular/material-tools/pull/18.patch","issue_url":"https://api.github.com/repos/angular/material-tools/issues/18","number":18,"state":"open","locked":false,"title":"docs: add document to explain how the tools work","user":{"login":"DevVersion","id":4987015,"avatar_url":"https://avatars.githubusercontent.com/u/4987015?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVersion","html_url":"https://github.com/DevVersion","followers_url":"https://api.github.com/users/DevVersion/followers","following_url":"https://api.github.com/users/DevVersion/following{/other_user}","gists_url":"https://api.github.com/users/DevVersion/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVersion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVersion/subscriptions","organizations_url":"https://api.github.com/users/DevVersion/orgs","repos_url":"https://api.github.com/users/DevVersion/repos","events_url":"https://api.github.com/users/DevVersion/events{/privacy}","received_events_url":"https://api.github.com/users/DevVersion/received_events","type":"User","site_admin":false},"body":"The previous PR was accidentally merged due some confusion :smile:  \r\n\r\nWe want @ThomasBurleson to have the final look over it.","created_at":"2016-08-16T11:25:53Z","updated_at":"2016-08-16T16:36:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b1b9052affb20b920287bdf7f6e127d06fbc84e","assignee":{"login":"ThomasBurleson","id":210413,"avatar_url":"https://avatars.githubusercontent.com/u/210413?v=3","gravatar_id":"","url":"https://api.github.com/users/ThomasBurleson","html_url":"https://github.com/ThomasBurleson","followers_url":"https://api.github.com/users/ThomasBurleson/followers","following_url":"https://api.github.com/users/ThomasBurleson/following{/other_user}","gists_url":"https://api.github.com/users/ThomasBurleson/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasBurleson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasBurleson/subscriptions","organizations_url":"https://api.github.com/users/ThomasBurleson/orgs","repos_url":"https://api.github.com/users/ThomasBurleson/repos","events_url":"https://api.github.com/users/ThomasBurleson/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasBurleson/received_events","type":"User","site_admin":false},"assignees":[{"login":"ThomasBurleson","id":210413,"avatar_url":"https://avatars.githubusercontent.com/u/210413?v=3","gravatar_id":"","url":"https://api.github.com/users/ThomasBurleson","html_url":"https://github.com/ThomasBurleson","followers_url":"https://api.github.com/users/ThomasBurleson/followers","following_url":"https://api.github.com/users/ThomasBurleson/following{/other_user}","gists_url":"https://api.github.com/users/ThomasBurleson/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasBurleson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasBurleson/subscriptions","organizations_url":"https://api.github.com/users/ThomasBurleson/orgs","repos_url":"https://api.github.com/users/ThomasBurleson/repos","events_url":"https://api.github.com/users/ThomasBurleson/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasBurleson/received_events","type":"User","site_admin":false},{"login":"crisbeto","id":4450522,"avatar_url":"https://avatars.githubusercontent.com/u/4450522?v=3","gravatar_id":"","url":"https://api.github.com/users/crisbeto","html_url":"https://github.com/crisbeto","followers_url":"https://api.github.com/users/crisbeto/followers","following_url":"https://api.github.com/users/crisbeto/following{/other_user}","gists_url":"https://api.github.com/users/crisbeto/gists{/gist_id}","starred_url":"https://api.github.com/users/crisbeto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crisbeto/subscriptions","organizations_url":"https://api.github.com/users/crisbeto/orgs","repos_url":"https://api.github.com/users/crisbeto/repos","events_url":"https://api.github.com/users/crisbeto/events{/privacy}","received_events_url":"https://api.github.com/users/crisbeto/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/angular/material-tools/pulls/18/commits","review_comments_url":"https://api.github.com/repos/angular/material-tools/pulls/18/comments","review_comment_url":"https://api.github.com/repos/angular/material-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/material-tools/issues/18/comments","statuses_url":"https://api.github.com/repos/angular/material-tools/statuses/7732907822457eb8334a9e27c91bcf3db7c5d66a","head":{"label":"angular:docs/architecture-md","ref":"docs/architecture-md","sha":"7732907822457eb8334a9e27c91bcf3db7c5d66a","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":63349117,"name":"material-tools","full_name":"angular/material-tools","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/material-tools","description":"Tools for Angular Material 1.x","fork":false,"url":"https://api.github.com/repos/angular/material-tools","forks_url":"https://api.github.com/repos/angular/material-tools/forks","keys_url":"https://api.github.com/repos/angular/material-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/material-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/material-tools/teams","hooks_url":"https://api.github.com/repos/angular/material-tools/hooks","issue_events_url":"https://api.github.com/repos/angular/material-tools/issues/events{/number}","events_url":"https://api.github.com/repos/angular/material-tools/events","assignees_url":"https://api.github.com/repos/angular/material-tools/assignees{/user}","branches_url":"https://api.github.com/repos/angular/material-tools/branches{/branch}","tags_url":"https://api.github.com/repos/angular/material-tools/tags","blobs_url":"https://api.github.com/repos/angular/material-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/material-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/material-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/material-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/material-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/material-tools/languages","stargazers_url":"https://api.github.com/repos/angular/material-tools/stargazers","contributors_url":"https://api.github.com/repos/angular/material-tools/contributors","subscribers_url":"https://api.github.com/repos/angular/material-tools/subscribers","subscription_url":"https://api.github.com/repos/angular/material-tools/subscription","commits_url":"https://api.github.com/repos/angular/material-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/material-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/material-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/material-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/material-tools/contents/{+path}","compare_url":"https://api.github.com/repos/angular/material-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/material-tools/merges","archive_url":"https://api.github.com/repos/angular/material-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/material-tools/downloads","issues_url":"https://api.github.com/repos/angular/material-tools/issues{/number}","pulls_url":"https://api.github.com/repos/angular/material-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/material-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/material-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/material-tools/labels{/name}","releases_url":"https://api.github.com/repos/angular/material-tools/releases{/id}","deployments_url":"https://api.github.com/repos/angular/material-tools/deployments","created_at":"2016-07-14T15:41:29Z","updated_at":"2016-07-23T22:44:36Z","pushed_at":"2016-08-16T11:25:53Z","git_url":"git://github.com/angular/material-tools.git","ssh_url":"git@github.com:angular/material-tools.git","clone_url":"https://github.com/angular/material-tools.git","svn_url":"https://github.com/angular/material-tools","homepage":null,"size":202,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":5,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"07966b6037822db29318f0316b4e046ebb4f246e","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":63349117,"name":"material-tools","full_name":"angular/material-tools","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/material-tools","description":"Tools for Angular Material 1.x","fork":false,"url":"https://api.github.com/repos/angular/material-tools","forks_url":"https://api.github.com/repos/angular/material-tools/forks","keys_url":"https://api.github.com/repos/angular/material-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/material-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/material-tools/teams","hooks_url":"https://api.github.com/repos/angular/material-tools/hooks","issue_events_url":"https://api.github.com/repos/angular/material-tools/issues/events{/number}","events_url":"https://api.github.com/repos/angular/material-tools/events","assignees_url":"https://api.github.com/repos/angular/material-tools/assignees{/user}","branches_url":"https://api.github.com/repos/angular/material-tools/branches{/branch}","tags_url":"https://api.github.com/repos/angular/material-tools/tags","blobs_url":"https://api.github.com/repos/angular/material-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/material-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/material-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/material-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/material-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/material-tools/languages","stargazers_url":"https://api.github.com/repos/angular/material-tools/stargazers","contributors_url":"https://api.github.com/repos/angular/material-tools/contributors","subscribers_url":"https://api.github.com/repos/angular/material-tools/subscribers","subscription_url":"https://api.github.com/repos/angular/material-tools/subscription","commits_url":"https://api.github.com/repos/angular/material-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/material-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/material-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/material-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/material-tools/contents/{+path}","compare_url":"https://api.github.com/repos/angular/material-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/material-tools/merges","archive_url":"https://api.github.com/repos/angular/material-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/material-tools/downloads","issues_url":"https://api.github.com/repos/angular/material-tools/issues{/number}","pulls_url":"https://api.github.com/repos/angular/material-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/material-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/material-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/material-tools/labels{/name}","releases_url":"https://api.github.com/repos/angular/material-tools/releases{/id}","deployments_url":"https://api.github.com/repos/angular/material-tools/deployments","created_at":"2016-07-14T15:41:29Z","updated_at":"2016-07-23T22:44:36Z","pushed_at":"2016-08-16T11:25:53Z","git_url":"git://github.com/angular/material-tools.git","ssh_url":"git@github.com:angular/material-tools.git","clone_url":"https://github.com/angular/material-tools.git","svn_url":"https://github.com/angular/material-tools","homepage":null,"size":202,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/material-tools/pulls/18"},"html":{"href":"https://github.com/angular/material-tools/pull/18"},"issue":{"href":"https://api.github.com/repos/angular/material-tools/issues/18"},"comments":{"href":"https://api.github.com/repos/angular/material-tools/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/material-tools/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/material-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/material-tools/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/angular/material-tools/statuses/7732907822457eb8334a9e27c91bcf3db7c5d66a"}}}}
{"actor":{"display_login":"DevVersion"}}