diff --git a/docs/Configuration.md b/docs/Configuration.md index 4c7e4c55..a915848b 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -579,6 +579,10 @@ module.exports = { If you don't have a template at `src/index.html` or specify one via `template`, nwb will fall back to using a basic template which has the following properties you can configure: +- `lang` - the language of document `` + + > Default: `'en'` + - `title` - contents for `` > Default: the value of `name` from your app's `package.json` diff --git a/src/appCommands.js b/src/appCommands.js index 71c2460f..ae159b52 100644 --- a/src/appCommands.js +++ b/src/appCommands.js @@ -125,6 +125,7 @@ export function getDefaultHTMLConfig(cwd: string = process.cwd()) { // Otherwise provide default variables for the internal template, in case we // fall back to it. return { + lang: 'en', mountId: 'app', title: require(path.join(cwd, 'package.json')).name, } diff --git a/src/commands/build-demo.js b/src/commands/build-demo.js index 5c1970f7..4e38b537 100644 --- a/src/commands/build-demo.js +++ b/src/commands/build-demo.js @@ -28,6 +28,7 @@ function getCommandConfig(args) { }, plugins: { html: { + lang: 'en', mountId: 'demo', title: args.title || `${pkg.name} ${pkg.version} Demo`, }, diff --git a/src/commands/serve-react-demo.js b/src/commands/serve-react-demo.js index 16cb15cc..e0535482 100644 --- a/src/commands/serve-react-demo.js +++ b/src/commands/serve-react-demo.js @@ -25,6 +25,7 @@ export default function serveReactDemo(args, cb) { }, plugins: { html: { + lang: 'en', mountId: 'demo', title: `${pkg.name} ${pkg.version} Demo`, }, diff --git a/templates/inferno-app/src/index.html b/templates/inferno-app/src/index.html index e07684fa..13be8d55 100644 --- a/templates/inferno-app/src/index.html +++ b/templates/inferno-app/src/index.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> diff --git a/templates/preact-app/src/index.html b/templates/preact-app/src/index.html index e07684fa..13be8d55 100644 --- a/templates/preact-app/src/index.html +++ b/templates/preact-app/src/index.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> diff --git a/templates/react-app/src/index.html b/templates/react-app/src/index.html index e07684fa..13be8d55 100644 --- a/templates/react-app/src/index.html +++ b/templates/react-app/src/index.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> diff --git a/templates/web-app/src/index.html b/templates/web-app/src/index.html index e07684fa..13be8d55 100644 --- a/templates/web-app/src/index.html +++ b/templates/web-app/src/index.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> diff --git a/templates/webpack-template.html b/templates/webpack-template.html index cc99def6..e5ef8987 100644 --- a/templates/webpack-template.html +++ b/templates/webpack-template.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html> +<html lang="<%= htmlWebpackPlugin.options.lang %>"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">