Skip to content
This repository has been archived by the owner on Dec 9, 2019. It is now read-only.

Commit

Permalink
Merge pull request #90 from PolymerX/develop
Browse files Browse the repository at this point in the history
Merge develop into master for 1.0.0-beta-1
  • Loading branch information
LasaleFamine authored Nov 30, 2017
2 parents 6cc16b8 + 0e264d7 commit 0a78b0d
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"Mattia Astorino (http://equinsuocha.io/)"
],
"scripts": {
"prebuild": "NODE_ENV=production webpack --config webpack-module-build.config.js",
"build": "NODE_ENV=production webpack --optimize-minimize",
"postbuild": "NODE_ENV=production webpack --config webpack-module-build.config.js",
"dev": "webpack-dev-server --hot --inline",
"dev:module": "BROWSERS=module webpack-dev-server --hot --inline",
"pretest": "yarn linkbower && yarn build",
Expand Down
18 changes: 0 additions & 18 deletions src/assets/icons/manifest.json

This file was deleted.

22 changes: 18 additions & 4 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

<title>Polymer Skeleton</title>

<link rel="shortcut icon" sizes="32x32" href="/images/news-icon-32.png">
<meta name="theme-color" content="#000">
<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/icons/favicon-32x32.png">
Expand Down Expand Up @@ -72,6 +70,24 @@
} else {
console.log('Service worker is not supported');
}

document.addEventListener('WebComponentsReady', function componentsReady() {
document.removeEventListener('WebComponentsReady', componentsReady, false);

var script = document.createElement('script');
script.async = true
script.src = './bundle.js';
script.setAttribute('nomodule', true);

var scriptModule = document.createElement('script');
scriptModule.async = true
scriptModule.src = './module.bundle.js';
scriptModule.setAttribute('type', 'module');

var refScript = document.body.getElementsByTagName('script')[0];
refScript.parentNode.insertBefore(script, refScript);
refScript.parentNode.insertBefore(scriptModule, refScript);
}, false);
</script>
</head>

Expand All @@ -82,8 +98,6 @@

<script src="./vendor/custom-elements-es5-adapter.js" async nomodule></script>
<script src="./vendor/webcomponents-lite.js" async></script>
<script src="./bundle.js" async nomodule></script>
<script src="./module.bundle.js" async type="module"></script>
</body>

</html>
32 changes: 14 additions & 18 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{
"name": "Polymer Skeleton",
"short_name": "PX Skeleton",
"name": "",
"icons": [{
"src": "/images/logos/p-logo-32.png",
"type": "image/png",
"sizes": "32x32"
}, {
"src": "/images/logos/p-logo-192.png",
"type": "image/png",
"sizes": "192x192"
}, {
"src": "/images/logos/p-logo-512.png",
"type": "image/png",
"sizes": "512x512"
}],
"start_url": "/",
"display": "standalone",
"background_color": "#eceff1",
"theme_color": "#2e9be6"
"src": "/assets/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/icons/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
6 changes: 5 additions & 1 deletion webpack-module-build.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const {resolve} = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');

const pkg = require('./package.json');

Expand All @@ -16,7 +17,10 @@ const processEnv = {
/**
* Plugin configuration
*/
const plugins = [new webpack.DefinePlugin({'process.env': processEnv})];
const plugins = [
new webpack.DefinePlugin({'process.env': processEnv}),
new CleanWebpackPlugin([outputPath], {verbose: true})
];

/**
* === Webpack configuration
Expand Down
8 changes: 5 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const {resolve, join} = require('path');
const webpack = require('webpack');
const WorkboxPlugin = require('workbox-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');

const pkg = require('./package.json');

Expand Down Expand Up @@ -36,6 +35,10 @@ const copyStatics = {
from: resolve('./node_modules/@webcomponents/webcomponentsjs/webcomponents-sd-ce.js'),
to: join(outputPath, 'vendor'),
flatten: true
}, {
from: resolve('./node_modules/@webcomponents/webcomponentsjs/webcomponents-hi-sd-ce.js'),
to: join(outputPath, 'vendor'),
flatten: true
}, {
from: resolve('./node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'),
to: join(outputPath, 'vendor'),
Expand Down Expand Up @@ -65,13 +68,12 @@ const plugins = isDev ? [
] : [
new WorkboxPlugin({
globDirectory: outputPath,
globPatterns: ['**/*.{html,js,css}'],
globPatterns: ['**/*.{html, js, css, svg, png, woff, woff2, ttf}'],
swDest: join(outputPath, 'sw.js')
}),
new CopyWebpackPlugin(
[].concat(copyStatics.copyWebcomponents, copyStatics.copyOthers)
),
new CleanWebpackPlugin([outputPath], {verbose: true}),
new webpack.DefinePlugin({'process.env': processEnv})
];

Expand Down

0 comments on commit 0a78b0d

Please sign in to comment.