Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide instructions on publishing GH Pages #162

Merged
merged 6 commits into from
Jul 24, 2016
Merged

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Jul 24, 2016

This continues #94 and integrates it into the tool more tightly.
By default, you see this after npm run build:

screen shot 2016-07-25 at 00 16 46

However, if you specify homepage in package.json, you will see something like this instead:

screen shot 2016-07-25 at 00 23 59

Maybe we can even detect the host in the future by URL and offer other sequences of commands without necessarily embedding them into the tool. The user can always copy and paste them into a custom script, if they want to. This way it’s super easy to keep deploy customizable without adding flags to the tool.

@@ -32,16 +32,26 @@ webpack(config).run(function(err, stats) {
var openCommand = process.platform === 'win32' ? 'start' : 'open';
var homepagePath = require(path.resolve(relative, 'package.json')).homepage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have a path issue here - it is looking for package.json in my user directory. Maybe something like path.resolve(__dirname, relative, '..', 'package.json')?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you send a PR? I already merged the other one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep will do!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird though, relative should be correct here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I'll fix it in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good - thanks!

@gaearon gaearon merged commit 458d3f9 into master Jul 24, 2016
@gaearon
Copy link
Contributor Author

gaearon commented Jul 24, 2016

Paths should be fixed now, opened #163 to investigate why e2e didn't fail. (If you'd like, take a look please.)

@dhruska
Copy link
Contributor

dhruska commented Jul 24, 2016

Sounds good, will check it out

@mxstbr mxstbr deleted the publish-to-gh-pages branch July 25, 2016 04:56
@clouless
Copy link

thx for fixing this.
any idea when a new version will be released to npmjs containing this fix?

@gaearon
Copy link
Contributor Author

gaearon commented Jul 25, 2016

Within a week.

@gaearon gaearon added this to the 0.2.0 milestone Jul 25, 2016
@selfup
Copy link

selfup commented Jul 25, 2016

Not sure it is required to git push origin :gh-pages prior to the subtree command

The subtree command only pushes the build folder to the branch even if it doesn't exist.

Otherwise, awesome work!

@gaearon
Copy link
Contributor Author

gaearon commented Jul 25, 2016

I had errors using subtree push when the branch existed.

@selfup
Copy link

selfup commented Jul 25, 2016

Oh interesting. Thanks for clearing that up!

@rafgraph
Copy link
Contributor

This is great, but if you add a router it doesn't work because GitHub Pages doesn't natively support single page apps with frontend routing (unless it's the ugly hashtag kind). It might be good for the docs to mention this. There is a simple workaround for this by adding a 404.html file with a redirect script, see Single Page Apps for GitHub Pages.

@gaearon
Copy link
Contributor Author

gaearon commented Jul 29, 2016

if you add a router it doesn't work because GitHub Pages doesn't natively support single page apps with frontend routing

That’s the tradeoff, yes. PRs to docs are super welcome.

It might be good for the docs to mention this. There is a simple workaround for this by adding a 404.html file with a redirect script, see Single Page Apps for GitHub Pages.

OMG, that’s such a cool approach. We should definitely link to that.

@gaearon
Copy link
Contributor Author

gaearon commented Jul 29, 2016

Actually I think we should detect if your homepage field contains github.io, and if so, just embed that piece as part of HtmlWebpackPlugin processing, and emit an additional 404.html. Would you like to work on this?

@selfup
Copy link

selfup commented Jul 29, 2016

@gaearon

Only problem with that is that a good amount of people have custom domains pointed to their username.github.io.

Wonder if there needs to be another field in the JSON? Like: "gh-pages": true or something.

Otherwise, @RAFREX that custom 404.html with the redirect script is really nice!

@rafgraph
Copy link
Contributor

Just made a PR to add a note about the router to the template readme (love the "contribute some" link, made it super easy).

I think there would need to be some sort of flag, like "gh-pages": true because of custom domains. Also, if it's a project pages site it must use a custom domain in order GitHub Pages to serve the custom 404.html file (if it's a user or organization pages site, then a custom domain is not required).

@gaearon
Copy link
Contributor Author

gaearon commented Jul 29, 2016

Let’s stick with just the doc notice then for now.

@rafgraph
Copy link
Contributor

Okay, sounds good.

@chibicode
Copy link
Contributor

chibicode commented Sep 1, 2016

@domenic has also written a gist explaining how to deploy automatically using Travis (seems to have some problem, so please see its comments)
https://gist.github.com/domenic/ec8b0fc8ab45f39403dd

Also this might be useful:
https://github.com/blog/2228-simpler-github-pages-publishing

image

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants