Skip to content

Commit cfb3f30

Browse files
committed
Added production build with assetgraph-builder
1 parent 0d553c3 commit cfb3f30

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
public-min

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Put all 'bin' dirs beneath node_modules into $PATH so that we're using
2+
# the locally installed AssetGraph:
3+
# Ugly 'subst' hack: Check the Make Manual section 8.1 - Function Call Syntax
4+
NPM_BINS := $(subst bin node,bin:node,$(shell if test -d node_modules; then find node_modules/ -name bin -type d; fi))
5+
ifneq ($(NPM_BINS),)
6+
PATH := ${NPM_BINS}:${PATH}
7+
endif
8+
9+
deps := $(shell find public/ -type f -name "*.*")
10+
11+
public-min: public/index.html $(deps)
12+
buildProduction \
13+
--root public \
14+
--outroot public-min \
15+
$<
16+
17+
PHONY: clean
18+
19+
clean:
20+
rm -rf public-min

bin/server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
var connect = require('connect'),
44
http = require('http');
55

6-
var app = connect().use(connect.static('public'));
6+
var app = connect().use(connect.static('public-min'));
77

88
http.createServer(app).listen(process.env.PORT || 3000);

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"dependencies": {
2323
"connect": "~2.0.3"
2424
},
25-
"devDependencies": {},
25+
"devDependencies": {
26+
"assetgraph-builder": "latest"
27+
}
2628
"engines": {
2729
"node": ">=0.6"
2830
},

0 commit comments

Comments
 (0)