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

gatsby-plugin-netlify-cms V3 version #8662

Closed
pungggi opened this issue Oct 1, 2018 · 10 comments
Closed

gatsby-plugin-netlify-cms V3 version #8662

pungggi opened this issue Oct 1, 2018 · 10 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@pungggi
Copy link

pungggi commented Oct 1, 2018

Because we are encouraged to cache also the Javascript Files this Html output should include version of the cms:

Example:

<html>
  <head>
    <meta charset="UTF-8">
    <title>Content Manager</title>
  </head>
  <body>
  <script type="text/javascript" src="cms.js?2.2.0"></script></body>
</html>
@pungggi
Copy link
Author

pungggi commented Oct 1, 2018

I have done a quick hack... by adding this in gatsby node (of the plugin..)

const loadPackage = require("load-pkg-config");
...
           /**
           * Auto generate CMS index.html page.
           */
          new _htmlWebpackPlugin.default({
            title: htmlTitle,
            version: loadPackage("netlify-cms").version,
            template: __dirname + "/index.html",
            excludeAssets: [/cms.css/]
          }),

with the html template

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>
    <%= htmlWebpackPlugin.options.title %>
  </title>
</head>

<body>
  <script type="text/javascript" src="cms.js?<%= htmlWebpackPlugin.options.version %>"></script>
</body>

</html>

The result is like this, dont know why

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>
    Content Manager
  </title>
</head>

<body>
  <script type="text/javascript" src="cms.js?2.1.2"></script>
 <script type="text/javascript" src="cms.js"></script>
</body>

</html>

@kakadiadarpan
Copy link
Contributor

@pungggi cms.js script tag is inserted dynamically at build time. You'll need to modify the options for html-webpack-plugin.

@kakadiadarpan kakadiadarpan added the type: question or discussion Issue discussing or asking a question about Gatsby label Oct 1, 2018
@pungggi
Copy link
Author

pungggi commented Oct 1, 2018

I think I tried excludeChunks: ["cms"] but the script was still included.
Anyway, once sorted this out, would you accept a PR for that? @erquhart

@kakadiadarpan
Copy link
Contributor

Sure, we always welcome community contributions!

@erquhart
Copy link
Contributor

The CMS plugin runs it's own webpack build. It doesn't impact the performance of the main site, so I wouldn't be concerned with caching here.

@pungggi
Copy link
Author

pungggi commented Oct 23, 2018

hi @erquhart, the concern is about the Client getting the updated Version in case the cms.js is updated.

@erquhart
Copy link
Contributor

Ah, okay. I've never heard of anyone having an issue with this using Netlify CMS, have you? If so the fix makes sense, I'd at least say we should use a valid query parameter and say ?v=<version>. But again, I'm not certain this is actually necessary as modern CDN's do a pretty good job of recognizing changes in source files.

@gatsbot
Copy link

gatsbot bot commented Jan 25, 2019

Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open!

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jan 25, 2019
@pungggi
Copy link
Author

pungggi commented Feb 1, 2019

Yes, the User needs to Force reload when a new release is out. Has anyone else seen this?

@gatsbot
Copy link

gatsbot bot commented Feb 12, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants