{"action":"opened","issue":{"url":"https://api.github.com/repos/voorhoede/fastatic/issues/48","repository_url":"https://api.github.com/repos/voorhoede/fastatic","labels_url":"https://api.github.com/repos/voorhoede/fastatic/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/voorhoede/fastatic/issues/48/comments","events_url":"https://api.github.com/repos/voorhoede/fastatic/issues/48/events","html_url":"https://github.com/voorhoede/fastatic/issues/48","id":169738942,"number":48,"title":"Output examples to and serve locally from `dist/examples/`","user":{"login":"jbmoelker","id":1516059,"avatar_url":"https://avatars.githubusercontent.com/u/1516059?v=3","gravatar_id":"","url":"https://api.github.com/users/jbmoelker","html_url":"https://github.com/jbmoelker","followers_url":"https://api.github.com/users/jbmoelker/followers","following_url":"https://api.github.com/users/jbmoelker/following{/other_user}","gists_url":"https://api.github.com/users/jbmoelker/gists{/gist_id}","starred_url":"https://api.github.com/users/jbmoelker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbmoelker/subscriptions","organizations_url":"https://api.github.com/users/jbmoelker/orgs","repos_url":"https://api.github.com/users/jbmoelker/repos","events_url":"https://api.github.com/users/jbmoelker/events{/privacy}","received_events_url":"https://api.github.com/users/jbmoelker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/voorhoede/fastatic/labels/help%20wanted","name":"help wanted","color":"128A0C"},{"url":"https://api.github.com/repos/voorhoede/fastatic/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-06T09:40:03Z","updated_at":"2016-08-06T09:40:03Z","closed_at":null,"body":"Currently the output of examples is also placed in `examples/`. This is inconvenient, because we don't want the output to end up in git. So rather I'd suggest we output to a different directory `dist/examples/` (or `fastatic/examples/`?) which we can `.gitignore`.\r\n\r\nI'd also like it to be easier to parse all examples so I imagine a setup like:\r\n```json\r\n\"scripts\": {\r\n  \"examples\": \"npm-run-all --serial examples:*\",\r\n  \"examples:bootstrap\": \"./bin/fastatic examples/bootstrap-gh-pages/ --dest dist/examples/bootstrap/\",\r\n  \"examples:microsoft\": \"./bin/fastatic examples/microsoft.github.io-master/ --dest dist/examples/microsoft/\",\r\n  \"examples:react\": \"./bin/fastatic examples/react-gh-pages/ --dest dist/examples/react/\"\r\n}\r\n``` \r\nWe can make `npm run examples` part of the Travis build so passing the examples becomes a criterium for a successful build.\r\n\r\nNext I would like to be able to (pre)view the optimised examples. So for that we need to adjust `npm run start`. But that won't be enough. The *microsoft* example works out-of-the-box because it uses relative URLs. The *bootstrap* example works on all pages except the main `index.html` as all file references everywhere start which `../`, which is incorrect but doesn't lead to issues on getbootstrap.com as there it can't go further up than the domain itself. We could fix those manually in `examples/bootstrap-gh-pages/index.html` or setup a `pre` or `post` task to fix this. The *react* example is worse as it uses all relative to root paths (`/react/some/file.ext`). We could maybe insert a `<base>` tag to solve this or convert all URLs (with something like [`relateurl`](https://github.com/stevenvachon/relateurl) or [`rebase`](https://www.npmjs.com/package/rebase)?). So we would get something like our own rebase script (e.g. `./examples/lib/rebase-react`) after the regular fastatic script:\r\n\r\n```json\r\n{\r\n  \"examples:react\": \"./bin/fastatic examples/react-gh-pages/ --dest dist/examples/react/\",\r\n  \"postexamples:react\": \"./examples/lib/rebase-react\"\r\n}\r\n``` \r\n\r\nThe result should be that we are able to serve and preview all examples."}}
{"actor":{"display_login":"jbmoelker"}}