{"action":"created","comment":{"url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/comments/72236409","id":72236409,"diff_hunk":"@@ -0,0 +1,22 @@\n+<!doctype html>\n+<html lang=\"{{ lang }}\">\n+  <head>\n+    <meta charset=\"{{ charset }}\">","path":"src/index.html","position":4,"original_position":4,"commit_id":"5504b187fa916bcd4573ab9cbd8531b67c41f04f","original_commit_id":"5504b187fa916bcd4573ab9cbd8531b67c41f04f","user":{"login":"HugoGiraudel","id":1889710,"avatar_url":"https://avatars.githubusercontent.com/u/1889710?v=3","gravatar_id":"","url":"https://api.github.com/users/HugoGiraudel","html_url":"https://github.com/HugoGiraudel","followers_url":"https://api.github.com/users/HugoGiraudel/followers","following_url":"https://api.github.com/users/HugoGiraudel/following{/other_user}","gists_url":"https://api.github.com/users/HugoGiraudel/gists{/gist_id}","starred_url":"https://api.github.com/users/HugoGiraudel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HugoGiraudel/subscriptions","organizations_url":"https://api.github.com/users/HugoGiraudel/orgs","repos_url":"https://api.github.com/users/HugoGiraudel/repos","events_url":"https://api.github.com/users/HugoGiraudel/events{/privacy}","received_events_url":"https://api.github.com/users/HugoGiraudel/received_events","type":"User","site_admin":false},"body":"You could `| default: \"utf-8\"`, just in case.","created_at":"2016-07-26T12:12:53Z","updated_at":"2016-07-26T12:12:53Z","html_url":"https://github.com/iris-dni/iris-frontend/pull/6#discussion_r72236409","pull_request_url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/comments/72236409"},"html":{"href":"https://github.com/iris-dni/iris-frontend/pull/6#discussion_r72236409"},"pull_request":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6","id":78299782,"html_url":"https://github.com/iris-dni/iris-frontend/pull/6","diff_url":"https://github.com/iris-dni/iris-frontend/pull/6.diff","patch_url":"https://github.com/iris-dni/iris-frontend/pull/6.patch","issue_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues/6","number":6,"state":"open","locked":false,"title":"[WIP] Webfonts and Theming","user":{"login":"mattberridge","id":447493,"avatar_url":"https://avatars.githubusercontent.com/u/447493?v=3","gravatar_id":"","url":"https://api.github.com/users/mattberridge","html_url":"https://github.com/mattberridge","followers_url":"https://api.github.com/users/mattberridge/followers","following_url":"https://api.github.com/users/mattberridge/following{/other_user}","gists_url":"https://api.github.com/users/mattberridge/gists{/gist_id}","starred_url":"https://api.github.com/users/mattberridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattberridge/subscriptions","organizations_url":"https://api.github.com/users/mattberridge/orgs","repos_url":"https://api.github.com/users/mattberridge/repos","events_url":"https://api.github.com/users/mattberridge/events{/privacy}","received_events_url":"https://api.github.com/users/mattberridge/received_events","type":"User","site_admin":false},"body":"This PR got out of hand again, need to break things up more (by task) in future. \r\nHere is a summary of what this PR contains\r\n\r\n## Templating\r\n\r\nAdds [Nunjucks](https://mozilla.github.io/nunjucks/) as a [templating engine](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/server.js#L55), useful for our [index.html](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/index.html) and includes for scripts and `<head>` from the project default and from the user's theme.\r\n\r\nAdded a [`copy:theme`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/scripts/copy-theme.js) node command to bundle the index.html file to the build folder.\r\n\r\n## Env\r\n\r\nAdds `.env` to the project with `dotenv` lib. Parsing [on the server](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/babel.server.js#L2) added for server-side code. Also set up in the [webpack config](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/webpack.config.prod.js#L1) for client bundle, with [`webpack.EnvironmentPlugin`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/webpack.config.prod.js#L39) to define vars in `process.env` globally. We keep the `webpack.DefinePlugin` in production below this, to set the production mode for React via `process.env.NODE_ENV`.\r\n\r\nThe only `.env` var so far is `THEME_PATH` where the user defines their theme folder.\r\n\r\nAdded [`.env.default`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/.env.default) for the default settings checked-in to the repo.\r\n\r\n## Config\r\n\r\nI created a [master config file](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/config/index.js) which will export the config for the app.\r\n\r\nIt uses a [`mergeConfig`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/config/merge.js) helper to `Object.assign` the default and the custom (this will need extending in future I am sure, with `deepMerge` or so).\r\n\r\nI also created a [`requireThemeFile`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/helpers/requireThemeFile.js) helper where it grabs the theme path from `.env` and tries to require a file (JS or JSON) from the theme. If the file does not exist or errors then it returns an empty object. This is meant for requiring files which will overwrite defaults in the app if the user has provided them.\r\n\r\nSo now we have some theming flexibility with a [default theme config](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/theme/config.js) in the repo and then optional overwritten config defined by the user in the theme, merged and required in the app via `import config from 'config';`.\r\n\r\nConfig also includes an abstracted [`getBundles`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/config/bundles.js) function which define the core (i.e. required) script and stylesheet includes for the app, looped [in the template](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/index.html#L10). \r\n\r\n## Theme\r\n\r\n- The default theme for the app is now developed in `/src/theme`\r\n- The user defines their own, separate theme path in `.env` and customises their theme there\r\n\r\nI then added a [`copy-theme`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/scripts/copy-theme.js) node script to merge the two together and output to the build folder. Any files the user overwrites in their custom theme are taken and all additional ones added (for assets etc.)\r\n\r\nAn example of this is [`/theme/includes/scripts.html`](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/theme/includes/scripts.html) as a partial where the user will add custom tracking etc. scripts. By default we provide a blank file referenced [in the template](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/index.html#L24) - which would be overwritten by a file of the same name in the user's theme\r\n\r\n## Webfonts\r\n\r\nWe include a [webfonts partial](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/index.html#L9) in the default theme which includes the default font of Open Sans via Google and loading [via `loadCss` method](https://github.com/iris-dni/iris-frontend/blob/f2cd65fc40702818c7a876b1dd96c9be8ca6d355/src/theme/includes/webfonts.html). We keep flexibility here as the user (and us, later) can customise this include in their theme folder with the preferred / suitable [font loading method](https://www.zachleat.com/web/comprehensive-webfonts/).\r\n\r\nFont files / assets in the user's theme folder will be copied over via the build step above.\r\n\r\n## Assets\r\n\r\nStatic assets and scripts / styles which are core to the app (and not intended for customising) now live in the `/src/assets` folder.","created_at":"2016-07-21T11:27:52Z","updated_at":"2016-07-26T12:12:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8fae83efb88aefb81e6083be1a6b96e1fc55ab11","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6/commits","review_comments_url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6/comments","review_comment_url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues/6/comments","statuses_url":"https://api.github.com/repos/iris-dni/iris-frontend/statuses/5504b187fa916bcd4573ab9cbd8531b67c41f04f","head":{"label":"iris-dni:feature/webfonts-and-theming","ref":"feature/webfonts-and-theming","sha":"5504b187fa916bcd4573ab9cbd8531b67c41f04f","user":{"login":"iris-dni","id":20228271,"avatar_url":"https://avatars.githubusercontent.com/u/20228271?v=3","gravatar_id":"","url":"https://api.github.com/users/iris-dni","html_url":"https://github.com/iris-dni","followers_url":"https://api.github.com/users/iris-dni/followers","following_url":"https://api.github.com/users/iris-dni/following{/other_user}","gists_url":"https://api.github.com/users/iris-dni/gists{/gist_id}","starred_url":"https://api.github.com/users/iris-dni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iris-dni/subscriptions","organizations_url":"https://api.github.com/users/iris-dni/orgs","repos_url":"https://api.github.com/users/iris-dni/repos","events_url":"https://api.github.com/users/iris-dni/events{/privacy}","received_events_url":"https://api.github.com/users/iris-dni/received_events","type":"Organization","site_admin":false},"repo":{"id":63142341,"name":"iris-frontend","full_name":"iris-dni/iris-frontend","owner":{"login":"iris-dni","id":20228271,"avatar_url":"https://avatars.githubusercontent.com/u/20228271?v=3","gravatar_id":"","url":"https://api.github.com/users/iris-dni","html_url":"https://github.com/iris-dni","followers_url":"https://api.github.com/users/iris-dni/followers","following_url":"https://api.github.com/users/iris-dni/following{/other_user}","gists_url":"https://api.github.com/users/iris-dni/gists{/gist_id}","starred_url":"https://api.github.com/users/iris-dni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iris-dni/subscriptions","organizations_url":"https://api.github.com/users/iris-dni/orgs","repos_url":"https://api.github.com/users/iris-dni/repos","events_url":"https://api.github.com/users/iris-dni/events{/privacy}","received_events_url":"https://api.github.com/users/iris-dni/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iris-dni/iris-frontend","description":"The IRIS Frontend","fork":false,"url":"https://api.github.com/repos/iris-dni/iris-frontend","forks_url":"https://api.github.com/repos/iris-dni/iris-frontend/forks","keys_url":"https://api.github.com/repos/iris-dni/iris-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iris-dni/iris-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iris-dni/iris-frontend/teams","hooks_url":"https://api.github.com/repos/iris-dni/iris-frontend/hooks","issue_events_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/iris-dni/iris-frontend/events","assignees_url":"https://api.github.com/repos/iris-dni/iris-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/iris-dni/iris-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/iris-dni/iris-frontend/tags","blobs_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iris-dni/iris-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/iris-dni/iris-frontend/languages","stargazers_url":"https://api.github.com/repos/iris-dni/iris-frontend/stargazers","contributors_url":"https://api.github.com/repos/iris-dni/iris-frontend/contributors","subscribers_url":"https://api.github.com/repos/iris-dni/iris-frontend/subscribers","subscription_url":"https://api.github.com/repos/iris-dni/iris-frontend/subscription","commits_url":"https://api.github.com/repos/iris-dni/iris-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/iris-dni/iris-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/iris-dni/iris-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/iris-dni/iris-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iris-dni/iris-frontend/merges","archive_url":"https://api.github.com/repos/iris-dni/iris-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iris-dni/iris-frontend/downloads","issues_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/iris-dni/iris-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/iris-dni/iris-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iris-dni/iris-frontend/labels{/name}","releases_url":"https://api.github.com/repos/iris-dni/iris-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/iris-dni/iris-frontend/deployments","created_at":"2016-07-12T08:53:04Z","updated_at":"2016-07-13T14:32:31Z","pushed_at":"2016-07-26T12:03:08Z","git_url":"git://github.com/iris-dni/iris-frontend.git","ssh_url":"git@github.com:iris-dni/iris-frontend.git","clone_url":"https://github.com/iris-dni/iris-frontend.git","svn_url":"https://github.com/iris-dni/iris-frontend","homepage":null,"size":71,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"develop"}},"base":{"label":"iris-dni:develop","ref":"develop","sha":"60d9a7ab1fb070d89a45f683c72144c1141c6c07","user":{"login":"iris-dni","id":20228271,"avatar_url":"https://avatars.githubusercontent.com/u/20228271?v=3","gravatar_id":"","url":"https://api.github.com/users/iris-dni","html_url":"https://github.com/iris-dni","followers_url":"https://api.github.com/users/iris-dni/followers","following_url":"https://api.github.com/users/iris-dni/following{/other_user}","gists_url":"https://api.github.com/users/iris-dni/gists{/gist_id}","starred_url":"https://api.github.com/users/iris-dni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iris-dni/subscriptions","organizations_url":"https://api.github.com/users/iris-dni/orgs","repos_url":"https://api.github.com/users/iris-dni/repos","events_url":"https://api.github.com/users/iris-dni/events{/privacy}","received_events_url":"https://api.github.com/users/iris-dni/received_events","type":"Organization","site_admin":false},"repo":{"id":63142341,"name":"iris-frontend","full_name":"iris-dni/iris-frontend","owner":{"login":"iris-dni","id":20228271,"avatar_url":"https://avatars.githubusercontent.com/u/20228271?v=3","gravatar_id":"","url":"https://api.github.com/users/iris-dni","html_url":"https://github.com/iris-dni","followers_url":"https://api.github.com/users/iris-dni/followers","following_url":"https://api.github.com/users/iris-dni/following{/other_user}","gists_url":"https://api.github.com/users/iris-dni/gists{/gist_id}","starred_url":"https://api.github.com/users/iris-dni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iris-dni/subscriptions","organizations_url":"https://api.github.com/users/iris-dni/orgs","repos_url":"https://api.github.com/users/iris-dni/repos","events_url":"https://api.github.com/users/iris-dni/events{/privacy}","received_events_url":"https://api.github.com/users/iris-dni/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iris-dni/iris-frontend","description":"The IRIS Frontend","fork":false,"url":"https://api.github.com/repos/iris-dni/iris-frontend","forks_url":"https://api.github.com/repos/iris-dni/iris-frontend/forks","keys_url":"https://api.github.com/repos/iris-dni/iris-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iris-dni/iris-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iris-dni/iris-frontend/teams","hooks_url":"https://api.github.com/repos/iris-dni/iris-frontend/hooks","issue_events_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/iris-dni/iris-frontend/events","assignees_url":"https://api.github.com/repos/iris-dni/iris-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/iris-dni/iris-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/iris-dni/iris-frontend/tags","blobs_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iris-dni/iris-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/iris-dni/iris-frontend/languages","stargazers_url":"https://api.github.com/repos/iris-dni/iris-frontend/stargazers","contributors_url":"https://api.github.com/repos/iris-dni/iris-frontend/contributors","subscribers_url":"https://api.github.com/repos/iris-dni/iris-frontend/subscribers","subscription_url":"https://api.github.com/repos/iris-dni/iris-frontend/subscription","commits_url":"https://api.github.com/repos/iris-dni/iris-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/iris-dni/iris-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/iris-dni/iris-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/iris-dni/iris-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/iris-dni/iris-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iris-dni/iris-frontend/merges","archive_url":"https://api.github.com/repos/iris-dni/iris-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iris-dni/iris-frontend/downloads","issues_url":"https://api.github.com/repos/iris-dni/iris-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/iris-dni/iris-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/iris-dni/iris-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/iris-dni/iris-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iris-dni/iris-frontend/labels{/name}","releases_url":"https://api.github.com/repos/iris-dni/iris-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/iris-dni/iris-frontend/deployments","created_at":"2016-07-12T08:53:04Z","updated_at":"2016-07-13T14:32:31Z","pushed_at":"2016-07-26T12:03:08Z","git_url":"git://github.com/iris-dni/iris-frontend.git","ssh_url":"git@github.com:iris-dni/iris-frontend.git","clone_url":"https://github.com/iris-dni/iris-frontend.git","svn_url":"https://github.com/iris-dni/iris-frontend","homepage":null,"size":71,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6"},"html":{"href":"https://github.com/iris-dni/iris-frontend/pull/6"},"issue":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/issues/6"},"comments":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/iris-dni/iris-frontend/statuses/5504b187fa916bcd4573ab9cbd8531b67c41f04f"}}}}
{"actor":{"display_login":"HugoGiraudel"}}