Skip to content

Commit

Permalink
Add lang support and remove old conditional IE tags
Browse files Browse the repository at this point in the history
Based on the good work of @azat-io in #35.  Thank you.  People seem
happy to have this.
  • Loading branch information
jaketrent committed Jul 11, 2017
1 parent 739fb35 commit 49ea502
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ And some other optional:
- `devServer`: Insert the webpack-dev-server hot reload script at this host:port/path; e.g., http://localhost:3000.
- `googleAnalytics.trackingId`: Track usage of your site via [Google Analytics](http://analytics.google.com).
- `googleAnalytics.pageViewOnLoad`: Log a `pageview` event after the analytics code loads.
- `lang`: String identifying your content language
- `links`: Array of `<link>` elements.
- If an array element is a string, the value is assigned to the `href` attribute and the `rel` attribute is set to
`"stylesheet"`;
Expand Down Expand Up @@ -81,6 +82,7 @@ Here's an example webpack config illustrating how to use these options in your `
}
],
mobile: true,
lang: 'en-US',
links: [
'https://fonts.googleapis.com/css?family=Roboto',
{
Expand Down
9 changes: 3 additions & 6 deletions examples/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ var path = require('path')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
entry: [
'./index'
],
entry: ['./index'],
output: {
path: __dirname + '/dist',
filename: 'main.js'
},
resolveLoader: { root: path.join(__dirname, 'node_modules') },
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader' }
]
loaders: [{ test: /\.js$/, loader: 'babel-loader' }]
},
devServer: {
port: 3001
Expand All @@ -35,6 +31,7 @@ module.exports = {
}
],
mobile: true,
lang: 'en-US',
links: [
'https://fonts.googleapis.com/css?family=Roboto',
{
Expand Down
7 changes: 2 additions & 5 deletions index.ejs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<% var item, key %>

<% htmlWebpackPlugin.options.appMountIds = htmlWebpackPlugin.options.appMountIds || [] %>
<% htmlWebpackPlugin.options.lang = htmlWebpackPlugin.options.lang || "en" %>
<% htmlWebpackPlugin.options.links = htmlWebpackPlugin.options.links || [] %>
<% htmlWebpackPlugin.options.meta = htmlWebpackPlugin.options.meta || [] %>
<% htmlWebpackPlugin.options.scripts = htmlWebpackPlugin.options.scripts || [] %>

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6" lang="en"<% if (htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
<!--[if IE 7 ]> <html class="ie7" lang="en"<% if (htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
<!--[if IE 8 ]> <html class="ie8" lang="en"<% if (htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
<!--[if IE 9 ]> <html class="ie9" lang="en"<% if (htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"<% if (htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <!--<![endif]-->
<html lang="<%= htmlWebpackPlugin.options.lang %>" <% if (htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>>
<head>
<meta charset="utf-8">
<meta content="ie=edge" http-equiv="x-ua-compatible">
Expand Down

0 comments on commit 49ea502

Please sign in to comment.