Skip to content

Commit

Permalink
Add a noscript tag for better DX in develop mode with JS disabled (#566)
Browse files Browse the repository at this point in the history
Fixes #374
  • Loading branch information
nason authored and KyleAMathews committed Nov 28, 2016
1 parent ababd34 commit 39b7273
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/utils/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ import globPages from './glob-pages'
import webpackConfig from './webpack.config'
const debug = require('debug')('gatsby:application')

// Display a nice noscript message in dev mode explaining that server-side rendering
// is not enabled in develop mode
const devNoScript = `<noscript>
The Gatsby development server does not work without JavaScript enabled.
If you'd like to test how your site works without JavaScript, first build the site
'gatsby build' and then serve the built site 'gatsby serve-build'
</noscript>`

function startServer (program) {
const directory = program.directory

Expand Down Expand Up @@ -71,7 +79,7 @@ function startServer (program) {
try {
const htmlElement = React.createElement(
HTML, {
body: '',
body: devNoScript,
}
)
let html = ReactDOMServer.renderToStaticMarkup(htmlElement)
Expand Down

0 comments on commit 39b7273

Please sign in to comment.