Skip to content

Commit 7207de0

Browse files
committed
Shuffle things around a bit
Should improve page load of site and upkeep of the build
1 parent b7dd0b0 commit 7207de0

File tree

9 files changed

+85
-59
lines changed

9 files changed

+85
-59
lines changed

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
PATH := $(PWD)/node_modules/.bin:$(PATH)
2+
3+
.PHONY: bundle clean relink disc
4+
5+
bundle: build/bundle.min.js build/splash.min.js
6+
7+
clean:
8+
rm -rf build/*.js build/*.json data/*.md
9+
10+
disc:
11+
browserify src/index.js src/splash.js --full-paths | uglifyjs -c | discify --open
12+
13+
start: relink build/examples.json
14+
wzrd src/index.js:build/bundle.min.js \
15+
src/splash.js:build/splash.min.js
16+
17+
relink:
18+
district stackgl splash-grid
19+
20+
postinstall: relink
21+
scoped-bulk stackgl npm install
22+
npm dedupe
23+
24+
build/:
25+
mkdir build
26+
27+
build/bundle.min.js: build/ build/examples.json
28+
browserify src/index.js | uglifyjs -c > build/bundle.min.js
29+
30+
build/splash.min.js: build/ build/examples.json
31+
browserify src/splash.js | uglifyjs -c > build/splash.min.js
32+
33+
build/examples.json: build/ data/examples.md
34+
node data/regenerate
35+
36+
data/examples.md: build/
37+
node data/sync

build/bundle.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/splash.min.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ <h2>community</h2>
7676
<canvas></canvas>
7777
</section>
7878
</div>
79-
<script src="//cdn.webglstats.com/stat.js" defer="defer" async="async"></script>
8079
<script charset="utf-8">
8180
;(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
8281
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -86,6 +85,8 @@ <h2>community</h2>
8685
ga('create', 'UA-54792490-1', 'auto');
8786
ga('send', 'pageview');
8887
</script>
89-
<script charset="utf-8" src="bundle.js"></script>
88+
<script charset="utf-8" src="/build/bundle.min.js" defer="defer" async="async"></script>
89+
<script charset="utf-8" src="/build/splash.min.js" defer="defer" async="async"></script>
90+
<script src="//cdn.webglstats.com/stat.js" defer="defer" async="async"></script>
9091
</body>
9192
</html>

index.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@
2929
]
3030
},
3131
"scripts": {
32-
"prestart": "npm run links && node data/regenerate",
33-
"start": "wzrd index.js:bundle.js",
34-
"postinstall": "npm run links && scoped-bulk stackgl npm install && npm dedupe && npm run sync",
35-
"bundle": "npm run prestart && browserify index.js | uglifyjs -c > bundle.js",
36-
"links": "district stackgl splash-grid",
37-
"sync": "node data/sync",
38-
"disc": "browserify index.js --full-paths | uglifyjs -c | discify --open"
32+
"start": "make start",
33+
"clean": "make clean",
34+
"postinstall": "make postinstall",
35+
"prepublish": "make build/bundle.min.js build/splash.min.js"
3936
},
4037
"repository": {
4138
"type": "git",

src/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var filter = require('../lib/filter')
2+
var cl = require('class-list')
3+
var minstache = require('minstache')
4+
var domify = require('domify')
5+
var slice = require('sliced')
6+
var fs = require('fs')
7+
8+
require('../lib/fill')(document.querySelectorAll('[data-fill]'))
9+
10+
var thumb = minstache.compile(fs.readFileSync(
11+
__dirname + '/../lib/thumb.html'
12+
, 'utf8'))
13+
14+
var examples = require('../build/examples.json').map(function(meta) {
15+
return thumb(meta)
16+
}).join('\n')
17+
18+
document
19+
.getElementById('examples')
20+
.querySelector('ul.thumb-list')
21+
.appendChild(domify(examples))

src/splash.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var cl = require('class-list')
2+
3+
try {
4+
require('@stackgl/splash-grid')(
5+
document.getElementById('grid').querySelector('canvas')
6+
)
7+
} catch(e) {
8+
cl(document.body).add('no-webgl')
9+
}

0 commit comments

Comments
 (0)