Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

Commit

Permalink
Add document language option (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhnad authored Mar 7, 2020
1 parent a296ab9 commit 08b3de4
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<html lang="">`

> Default: `'en'`
- `title` - contents for `<title>`

> Default: the value of `name` from your app's `package.json`
Expand Down
1 change: 1 addition & 0 deletions src/appCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
1 change: 1 addition & 0 deletions src/commands/build-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function getCommandConfig(args) {
},
plugins: {
html: {
lang: 'en',
mountId: 'demo',
title: args.title || `${pkg.name} ${pkg.version} Demo`,
},
Expand Down
1 change: 1 addition & 0 deletions src/commands/serve-react-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function serveReactDemo(args, cb) {
},
plugins: {
html: {
lang: 'en',
mountId: 'demo',
title: `${pkg.name} ${pkg.version} Demo`,
},
Expand Down
2 changes: 1 addition & 1 deletion templates/inferno-app/src/index.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
2 changes: 1 addition & 1 deletion templates/preact-app/src/index.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
2 changes: 1 addition & 1 deletion templates/react-app/src/index.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
2 changes: 1 addition & 1 deletion templates/web-app/src/index.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
2 changes: 1 addition & 1 deletion templates/webpack-template.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down

0 comments on commit 08b3de4

Please sign in to comment.