Permalink
Browse files

Web app guidelines and shit, offline support

  • Loading branch information...
markasoftware committed Jan 12, 2018
1 parent f89a043 commit 7d997a3ce44bbec7eff2368a70895a4b7131aad5
View
@@ -2,17 +2,21 @@
# doesn't work with process substitution for some reason, so this will do
echo 'Combining specs...'
node build/gen-specs.js specs /tmp/specs.js public/generated/sitemap.txt
node build/gen-specs.js specs /tmp/specs.js public/sitemap.txt
[[ $1 == 'production' ]] && cssMini='csso' || cssMini='cat'
echo 'Bundling scripts...'
# TODO: maybe add --noparse /tmp/specs.js but last time i tried it didn't make a noticeable difference (but mithril did)
browserify -r /tmp/specs.js:spec-data --noparse mithril --debug src/js/entry.js > public/generated/bundle.js
browserify -r /tmp/specs.js:spec-data --noparse mithril --debug src/js/entry.js > public/bundle.js
if [[ $1 == 'production' ]]
then
echo 'Compiling and minifying scripts...'
babel public/generated/bundle.js | uglifyjs --compress --mangle --screw-ie8 > /tmp/bundle.js
mv /tmp/bundle.js public/generated/bundle.js
# we have to write it to tmp first then move because doing it all at once causes babel to freak the fuck out
# the file is truncated before babel has fully read it
babel public/bundle.js | uglifyjs -cmo public/bundle.js
echo 'Generating service worker...'
sw-precache --root=public --sw-file=sw.js --static-file-globs='public/*'
uglifyjs -cmo public/sw.js public/sw.js 2> /dev/null
fi
echo 'Bundling styles...'
cat src/css/*.css | $cssMini > public/generated/all.css
cat src/css/*.css | $cssMini > public/all.css
echo 'Build complete'
View
@@ -21,6 +21,7 @@
"js-yaml": "^3",
"mithril": "^1",
"natural-compare": "^1.4.0",
"sw-precache": "^5.2.0",
"tap-spec": "*",
"tape": "^4",
"uglify-js": "^2"
@@ -2,3 +2,4 @@ all.css
bundle.js
specs.json
sitemap.txt
sw.js
View
BIN +149 KB public/favicon.ico
Binary file not shown.
View
BIN +4.8 KB public/icon-192.png
Binary file not shown.
View
BIN +12.5 KB public/icon-512.png
Binary file not shown.
View
@@ -4,11 +4,13 @@
<title>SpecDB — View and Compare Graphics Cards and CPUs</title>
<meta name='description' content="Designed as an AMD equivalent of Intel's ARK, SpecDB is the definitive source for AMD hardware specifications">
<meta name='viewport' content='initial-scale=0.8, user-scalable=no, width=device-width'>
<meta name='theme-color' content='#ff4545'>
<meta charset='utf8'>
<script src='generated/bundle.js' defer></script>
<script src='bundle.js' defer></script>
<link rel='dns-prefetch' href='//fonts.gstatic.com'>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600|Quicksand:300,400" rel="stylesheet">
<link rel='stylesheet' href='generated/all.css'>
<link rel='stylesheet' href='all.css'>
<link rel='manifest' href='manifest.json'>
</head>
<body>
<div id='error-wrapper'>
View
@@ -0,0 +1,18 @@
{
"name": "SpecDB",
"short_name": "SpecDB",
"description": "View and compare graphics cards, CPUs, and APUs manufactured by AMD",
"start_url": ".",
"theme_color": "#ff4545",
"background_color": "#eee",
"display": "standalone",
"icons": [{
"src": "icon-192.png",
"type": "image/png",
"sizes": "192x192"
}, {
"src": "icon-512.png",
"type": "image/png",
"sizes": "512x512"
}]
}
View
@@ -1 +1 @@
Sitemap: https://specdb.info/generated/sitemap.txt
Sitemap: https://specdb.info/sitemap.txt
View
@@ -10,4 +10,10 @@ m.mount(document.getElementById('part-selector'), require('./part-selector.js'))
// extend part selector if no parts are selected on mobile
if(hash.getList().length === 0) {
document.getElementById('mobile-toggle').checked = true;
}
// service worker registration
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js')
.catch(() => console.log('Service worker registration failed, make sure you are in production mode'));
}

0 comments on commit 7d997a3

Please sign in to comment.