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

Integrated Webpack HTML Plugin. #1595

Merged
merged 23 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
105c2cf
Integrated Webpack HTML Plugin.
revanth0212 Aug 23, 2019
19ccdc6
feat: support static from root in upward
Aug 26, 2019
98edf92
fixup: stop PWADevServer writing to disk
Aug 26, 2019
dc96399
Added manifest.json route.
revanth0212 Aug 26, 2019
bdadc3c
Added generic meta and link tags.
revanth0212 Aug 26, 2019
2af0516
Added fonts to template.html.
revanth0212 Aug 26, 2019
3e74464
Exposing store name using DefinePlugin.
revanth0212 Aug 26, 2019
3423195
Using process.env instead of template options.
revanth0212 Aug 26, 2019
ca1238c
Images fix.
revanth0212 Aug 26, 2019
bf489da
Added the webpack plugin to fetch backend url.
revanth0212 Aug 27, 2019
d094618
Integrated the media backend url fetcher plugin.
revanth0212 Aug 27, 2019
4ae107a
Route change for venia icons in manifest.json
revanth0212 Aug 27, 2019
96278ed
Minor change.
revanth0212 Aug 27, 2019
a829d19
Renaming storeName to STORE_NAME and snapshot updates.
revanth0212 Aug 28, 2019
616a47d
Files rearrage.
revanth0212 Aug 28, 2019
47e1435
Added tests for MediaBackendURLFetcherPlugin.
revanth0212 Aug 28, 2019
951c13c
Using html minification.
revanth0212 Aug 28, 2019
c09a285
Minor.
revanth0212 Aug 28, 2019
bc687e5
Replaced magentoMediaBackendURL with MAGENTO_MEDIA_BACKEND_URL.
revanth0212 Aug 28, 2019
49eadca
Added comments.
revanth0212 Aug 28, 2019
ca63832
Minor.
revanth0212 Aug 29, 2019
d5f15a1
Merge branch 'develop' into webpackHtmlPluginIntegration
dpatil-magento Aug 30, 2019
9b0c74c
Merge branch 'develop' into webpackHtmlPluginIntegration
dpatil-magento Sep 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/pwa-buildpack/lib/WebpackTools/PWADevServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const PWADevServer = {
contentBase: false, // UpwardDevServerPlugin serves static files
compress: true,
hot: true,
writeToDisk: true,
watchOptions: {
// polling is CPU intensive - provide the option to turn it on if needed
poll: !!parseInt(devServer.watchOptionsUsePolling) || false
Expand Down Expand Up @@ -237,7 +236,7 @@ const PWADevServer = {
new UpwardDevServerPlugin(
webpackDevServerOptions,
process.env,
path.resolve(webpackConfig.output.path, upwardPath)
path.resolve(webpackConfig.context, upwardPath)
)
);

Expand Down
1 change: 1 addition & 0 deletions packages/venia-concept/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"graphql-cli": "~3.0.11",
"graphql-cli-validate-magento-pwa-queries": "~1.0.0",
"graphql-tag": "~2.10.1",
"html-webpack-plugin": "~3.2.0",
"informed": "~2.1.13",
"lodash.over": "~4.7.0",
"memoize-one": "~5.0.0",
Expand Down
61 changes: 61 additions & 0 deletions packages/venia-concept/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en" data-image-optimizing-origin="<%= process.env.IMAGE_OPTIMIZING_ORIGIN %>" data-media-backend="<%= htmlWebpackPlugin.options.mediaBackendUrl %>">
revanth0212 marked this conversation as resolved.
Show resolved Hide resolved
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#ff6334">
<link rel="manifest" href="/static/manifest.json">

<title>Home Page - <%= storeName %></title>
revanth0212 marked this conversation as resolved.
Show resolved Hide resolved

<!--
Apple Specific Tags

To be included until Safari supports WebAppManifest
See Docs:
- https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
- https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
-->
<!--
Apple Icons for Homescreen
Sizes: https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/app-icon/
-->
<link rel="apple-touch-icon" href="/icons/venia_square_57.png">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
<link rel="preconnect" href="<%= process.env.MAGENTO_BACKEND_URL %>">
revanth0212 marked this conversation as resolved.
Show resolved Hide resolved

<style type="text/css">
/* vietnamese */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 300;
font-display: swap;
src: local('Muli Light'), local('Muli-Light'), url(https://fonts.gstatic.com/s/muli/v13/7Au_p_0qiz-adZnkOCr2z24PMFk-0g.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 300;
font-display: swap;
src: local('Muli Light'), local('Muli-Light'), url(https://fonts.gstatic.com/s/muli/v13/7Au_p_0qiz-adZnkOCv2z24PMFk-0g.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 300;
font-display: swap;
src: local('Muli Light'), local('Muli-Light'), url(https://fonts.gstatic.com/s/muli/v13/7Au_p_0qiz-adZnkOCX2z24PMFk.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
</style>
</head>
<body>
<div id="root" />
</body>
</html>
13 changes: 13 additions & 0 deletions packages/venia-concept/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { configureWebpack } = require('@magento/pwa-buildpack');
const { DefinePlugin } = require('webpack');
const HTMLWebpackPlugin = require('html-webpack-plugin');

module.exports = async env => {
const config = await configureWebpack({
Expand Down Expand Up @@ -43,6 +45,17 @@ module.exports = async env => {
// Since it's a regular Webpack configuration, the object supports the
// `module.noParse` option in Webpack, documented here:
// https://webpack.js.org/configuration/module/#modulenoparse
revanth0212 marked this conversation as resolved.
Show resolved Hide resolved
config.plugins = [
...config.plugins,
new DefinePlugin({
revanth0212 marked this conversation as resolved.
Show resolved Hide resolved
storeName: JSON.stringify('Venia')
revanth0212 marked this conversation as resolved.
Show resolved Hide resolved
}),
new HTMLWebpackPlugin({
supernova-at marked this conversation as resolved.
Show resolved Hide resolved
filename: 'index.html',
template: './template.html',
mediaBackendUrl: new URL('/media/', process.env.MAGENTO_BACKEND_URL)
})
];

return config;
};
2 changes: 1 addition & 1 deletion packages/venia-ui/lib/RootComponents/Product/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Product extends Component {

return (
<Fragment>
<Title>{`${product.name} - Venia`}</Title>
<Title>{`${product.name} - ${storeName}`}</Title>
revanth0212 marked this conversation as resolved.
Show resolved Hide resolved
<ProductFullDetail
product={this.mapProduct(product)}
addToCart={this.props.addItemToCart}
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-ui/lib/components/App/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const App = props => {

return (
<HeadProvider>
<Title>{'Home Page - Venia'}</Title>
<Title>{`Home Page - ${storeName}`}</Title>
<Main
isMasked={overlay}
hasBeenOffline={hasBeenOffline}
Expand Down
Loading