Skip to content

Commit 63620fc

Browse files
committed
Merge pull request hojberg#7 from Munter/master
Added production build with assetgraph-builder
2 parents 0d553c3 + 8352c65 commit 63620fc

File tree

7 files changed

+32
-25
lines changed

7 files changed

+32
-25
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
},

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
<div id='content' class='clr'>
1414
<div class='preview_and_configuration'>
1515
<div class='preview'>
16-
<style class='preview_styles'></style>
1716
<div class='arrow_box'>
1817
<h1 class='logo'>css arrow please!</h1>
1918
</div>
@@ -68,6 +67,7 @@ <h2>Arrow configuration</h2>
6867

6968
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
7069
<script type="text/javascript" src="js/vendor/jscolor/jscolor.js"></script>
70+
<link rel="stylesheet" type="text/css" href="js/vendor/jscolor/jscolor.css">
7171

7272
<script src='js/lib/models/arrow.js'></script>
7373
<script src='js/lib/views/arrow_configuration_view.js'></script>

public/js/lib/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if (!('CSSArrowPlease' in window)) window.CSSArrowPlease = {};
3333

3434
this.views = [
3535
new G.ArrowConfigurationView({ model: model, container: $('.configuration') }),
36-
new G.ArrowPreviewView({ model: model, container: $('.preview_styles') }),
36+
new G.ArrowPreviewView({ model: model, container: $('<style type="text/css"></style>').appendTo('body') }),
3737
new G.ArrowCSSView({ model: model, container: $('.result_code') }),
3838
];
3939
},

public/js/vendor/jscolor/jscolor.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ var jscolor = {
596596
var p = jscolor.picker;
597597

598598
// controls interaction
599+
p.box.className = modeID ? 'value' : 'saturation';
599600
p.box.onmouseup =
600601
p.box.onmouseout = function() { target.focus(); };
601602
p.box.onmousedown = function() { abortBlur=true; };
@@ -637,6 +638,7 @@ var jscolor = {
637638
p.box.style.height = dims[1] + 'px';
638639

639640
// picker border
641+
p.boxB.className = 'jscolor';
640642
p.boxB.style.position = 'absolute';
641643
p.boxB.style.clear = 'both';
642644
p.boxB.style.left = x+'px';
@@ -647,6 +649,7 @@ var jscolor = {
647649
p.boxB.style.background = THIS.pickerFaceColor;
648650

649651
// pad image
652+
p.pad.className = 'pad';
650653
p.pad.style.width = jscolor.images.pad[0]+'px';
651654
p.pad.style.height = jscolor.images.pad[1]+'px';
652655

@@ -658,6 +661,7 @@ var jscolor = {
658661
p.padB.style.borderColor = THIS.pickerInsetColor;
659662

660663
// pad mouse area
664+
p.padM.className = 'cross';
661665
p.padM.style.position = 'absolute';
662666
p.padM.style.left = '0';
663667
p.padM.style.top = '0';
@@ -679,6 +683,7 @@ var jscolor = {
679683
p.sldB.style.borderColor = THIS.pickerInsetColor;
680684

681685
// slider mouse area
686+
p.sldM.className = 'arrow';
682687
p.sldM.style.display = THIS.slider ? 'block' : 'none';
683688
p.sldM.style.position = 'absolute';
684689
p.sldM.style.right = '0';
@@ -718,19 +723,6 @@ var jscolor = {
718723
};
719724
p.btnS.style.lineHeight = p.btn.style.height;
720725

721-
// load images in optimal order
722-
switch(modeID) {
723-
case 0: var padImg = 'hs.png'; break;
724-
case 1: var padImg = 'hv.png'; break;
725-
}
726-
p.padM.style.backgroundImage = "url('"+jscolor.getDir()+"cross.gif')";
727-
p.padM.style.backgroundRepeat = "no-repeat";
728-
p.sldM.style.backgroundImage = "url('"+jscolor.getDir()+"arrow.gif')";
729-
p.sldM.style.backgroundRepeat = "no-repeat";
730-
p.pad.style.backgroundImage = "url('"+jscolor.getDir()+padImg+"')";
731-
p.pad.style.backgroundRepeat = "no-repeat";
732-
p.pad.style.backgroundPosition = "0 0";
733-
734726
// place pointers
735727
redrawPad();
736728
redrawSld();
@@ -918,14 +910,6 @@ var jscolor = {
918910
};
919911
}
920912

921-
// require images
922-
switch(modeID) {
923-
case 0: jscolor.requireImage('hs.png'); break;
924-
case 1: jscolor.requireImage('hv.png'); break;
925-
}
926-
jscolor.requireImage('cross.gif');
927-
jscolor.requireImage('arrow.gif');
928-
929913
this.importColor();
930914
}
931915

0 commit comments

Comments
 (0)