Skip to content

Commit

Permalink
Add service worker scripts build settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ta-chibana committed Nov 26, 2017
1 parent 7e25e28 commit cb641a1
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
node_modules
public

public/index.js
public/firebase-messaging-sw.js

src/firebase/config.js

.firebaserc
database.rules.json
firebase.json
.firebaserc
src/firebase/config.js
firebase-debug.log
33 changes: 33 additions & 0 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page Not Found</title>

<style media="screen">
body { background: #ECEFF1; color: rgba(0,0,0,0.87); font-family: Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; }
#message { background: white; max-width: 360px; margin: 100px auto 16px; padding: 32px 24px 16px; border-radius: 3px; }
#message h3 { color: #888; font-weight: normal; font-size: 16px; margin: 16px 0 12px; }
#message h2 { color: #ffa100; font-weight: bold; font-size: 16px; margin: 0 0 8px; }
#message h1 { font-size: 22px; font-weight: 300; color: rgba(0,0,0,0.6); margin: 0 0 16px;}
#message p { line-height: 140%; margin: 16px 0 24px; font-size: 14px; }
#message a { display: block; text-align: center; background: #039be5; text-transform: uppercase; text-decoration: none; color: white; padding: 16px; border-radius: 4px; }
#message, #message a { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
#load { color: rgba(0,0,0,0.4); text-align: center; font-size: 13px; }
@media (max-width: 600px) {
body, #message { margin-top: 0; background: white; box-shadow: none; }
body { border-top: 16px solid #ffa100; }
}
</style>
</head>
<body>
<div id="message">
<h2>404</h2>
<h1>Page Not Found</h1>
<p>The specified file was not found on this website. Please check the URL for mistakes and try again.</p>
<h3>Why am I seeing this?</h3>
<p>This page was generated by the Firebase Command-Line Interface. To modify it, edit the <code>404.html</code> file in your project's configured <code>public</code> directory.</p>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>hanashiai</title>
</head>
<body>
<div id="app"></div>
<script src="./index.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions src/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import firebase from 'firebase'
import config from './firebase/config'

const { messagingSenderId } = config

firebase.initializeApp({
messagingSenderId
})

firebase.messaging()

console.log('service worker installed.')
7 changes: 5 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const path = require('path')

module.exports = {
entry: path.resolve(__dirname, 'src/index.jsx'),
entry: {
index: './src/index.jsx',
'firebase-messaging-sw': './src/firebase-messaging-sw.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'public'),
filename: 'index.js',
publicPath: '/'
},
module: {
Expand Down

0 comments on commit cb641a1

Please sign in to comment.