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

Made gatsby-plugin-netlify-cms work with gatsby v2 #6292

Merged
merged 2 commits into from
Jul 6, 2018
Merged

Made gatsby-plugin-netlify-cms work with gatsby v2 #6292

merged 2 commits into from
Jul 6, 2018

Conversation

emanueleperuffo
Copy link
Contributor

I've made gatsby-plugin-netlify-cms work with gatsby v2.

I've not used webpack-merge because I couldn't get something working in a reasonable amount of time and I didn't have too much time to learn it, so I've ended up using vanilla JavaScript.

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jul 4, 2018

Deploy preview for using-drupal ready!

Built with commit 3b9de63

https://deploy-preview-6292--using-drupal.netlify.com

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jul 4, 2018

Deploy preview for gatsbygram ready!

Built with commit 3b9de63

https://deploy-preview-6292--gatsbygram.netlify.com

@ascorbic
Copy link
Contributor

ascorbic commented Jul 5, 2018

Great work. It's worth tagging #6048

@shaunbent
Copy link
Contributor

Awesome work @emanueleperuffo - I am also blocked from completing my V2 upgrade because of this issue.

@@ -1,15 +1,16 @@
{
"name": "gatsby-plugin-netlify-cms",
"description": "A Gatsby plugin which generates the Netlify CMS single page app",
"version": "2.0.0-beta.3",
"version": "2.2.0-beta.15",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert this change? Versioning will be handled during the release process.

Copy link
Contributor

@m-allanson m-allanson left a comment

Choose a reason for hiding this comment

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

Good stuff, thanks @emanueleperuffo!

It looks like extract-text-webpack-plugin shouldn't be used for CSS anymore. See the usage note at https://github.com/webpack-contrib/extract-text-webpack-plugin#usage.

The mini-css-extract-plugin should be used instead.

Could you update this PR to use that instead?

"author": "Shawn Erquhart <shawn@erquh.art>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"dependencies": {
"@babel/runtime": "7.0.0-beta.51",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/webpack-contrib/extract-text-webpack-plugin#usage

⚠️ Since webpack v4 the extract-text-webpack-plugin should not be used for css. Use mini-css-extract-plugin instead.

@emanueleperuffo
Copy link
Contributor Author

@m-allanson I've moved to mini-css-extract-plugin and reverted back the version number.
In my previous commit, I increased the version number because npm thinks that v2.0.0-beta.n is a previous version of v2.0.1, which is the version of branch v1.

@donysukardi
Copy link
Contributor

I tested it. Seems to be working ok. However I'm seeing FOUC when I load the admin page

Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@KyleAMathews
Copy link
Contributor

I'll merge and release this now. Could someone investigate the FOUC issue @donysukardi saw and fix that?

@KyleAMathews KyleAMathews merged commit 06e7360 into gatsbyjs:master Jul 6, 2018
@steverandy
Copy link

Tried gatsby-plugin-netlify-cms@2.0.0-beta.4. The /admin/ page works on develop but it shows empty page on build.

@emanueleperuffo
Copy link
Contributor Author

emanueleperuffo commented Jul 7, 2018 via email

@emanueleperuffo
Copy link
Contributor Author

@steverandy The default export of netlify-identity-widget is undefined for gatsby build, but not for gatsby develop... I don't know how to fix this...

@steverandy
Copy link

I happened to have a similar issue.
I think may need to use require to import netlify-identity-widget.

I'm not sure why it behaves like this.

@emanueleperuffo
Copy link
Contributor Author

emanueleperuffo commented Jul 8, 2018

Also, I've found this in my production pages (not /admin):

<iframe id="netlify-identity-widget" style="position: fixed; top: 0; left: 0; border: none; width: 100%; height: 100%; overflow: visible; background: transparent; display: none; z-index: 99; " src="about:blank"></iframe>

I think that the code in cms.js goes to the main entry instead of the cms entry in this case...

@erquhart
Copy link
Contributor

erquhart commented Jul 9, 2018

Looking into this (all of the above) now.

@emanueleperuffo
Copy link
Contributor Author

I've created a new pr #6341

@jlengstorf
Copy link
Contributor

Hiya @emanueleperuffo! 👋

This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here.

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants