Still working on the Makefile.
This commit is contained in:
parent
02828b2bae
commit
2b09593ec7
44
Makefile
44
Makefile
|
@ -1,47 +1,47 @@
|
|||
.SUFFIXES: .nw .js .pdf .html .tex .haml .css .stylus
|
||||
.PHONY: setup
|
||||
.PHONY: setup store
|
||||
|
||||
NOTANGLE= notangle
|
||||
NOWEAVE= noweave
|
||||
ECHO= /bin/echo
|
||||
STYLUS= stylus
|
||||
ECHO= echo
|
||||
STYLUS= ./node_modules/stylus/bin/stylus
|
||||
HAML= haml
|
||||
COFFEE= coffee
|
||||
COFFEE= ./node_modules/coffee-script/bin/coffee
|
||||
|
||||
all: htdocs htdocs/index.html htdocs/store.js htdocs/jsonstore.css htdocs/lib/underscore.js htdocs/lib/jquery.js htdocs/lib/backbone.js htdocs/data/items.json
|
||||
LIBS:= htdocs/lib/underscore.js htdocs/lib/jquery.js htdocs/lib/backbone.js
|
||||
|
||||
setup:
|
||||
npm install
|
||||
bower install jquery underscore backbone
|
||||
all: htdocs/index.html htdocs/store.js htdocs/jsonstore.css htdocs/data/items.json
|
||||
@if [ ! -e "./htdocs/lib" ]; then echo "Please do 'make setup' before continuing"; fi
|
||||
|
||||
htdocs/lib:
|
||||
mkdir -p htdocs/lib
|
||||
|
||||
htdocs/lib/underscore.js:
|
||||
mkdir -p htdocs/lib
|
||||
htdocs/lib/underscore.js: htdocs/lib
|
||||
cp bower_components/underscore/underscore.js htdocs/lib
|
||||
|
||||
htdocs/lib/jquery.js:
|
||||
mkdir -p htdocs/lib
|
||||
htdocs/lib/jquery.js: htdocs/lib
|
||||
cp bower_components/jquery/dist/jquery.js htdocs/lib
|
||||
|
||||
htdocs/lib/backbone.js:
|
||||
cp bower_components/backbone/backbone.js htdocs/lib
|
||||
|
||||
install:
|
||||
npm install
|
||||
bower install jquery underscore backbone
|
||||
|
||||
setup: install $(LIBS)
|
||||
|
||||
work:
|
||||
mkdir -p work
|
||||
|
||||
docs:
|
||||
mkdir -p docs
|
||||
|
||||
htdocs:
|
||||
mkdir -p htdocs
|
||||
|
||||
work/index.haml: work src/backbonestore.nw
|
||||
$(NOTANGLE) -c -Rindex.haml src/backbonestore.nw > work/index.haml
|
||||
|
||||
htdocs/index.html: htdocs work/index.haml
|
||||
$(HAML) --unix-newlines --no-escape-attrs --double-quote-attribute work/index.haml > htdocs/index.html
|
||||
|
||||
work/index.haml: work src/backbonestore.nw
|
||||
$(NOTANGLE) -c -Rindex.haml src/backbonestore.nw > work/index.haml
|
||||
|
||||
htdocs/jsonstore.css: htdocs work/jsonstore.styl
|
||||
$(STYLUS) -o htdocs work/jsonstore.styl
|
||||
|
||||
|
@ -51,13 +51,9 @@ work/jsonstore.styl: work src/backbonestore.nw
|
|||
htdocs/store.js: htdocs work/store.coffee
|
||||
$(COFFEE) -o htdocs --compile work/store.coffee
|
||||
|
||||
work/store.coffee: work src/backbonestore.nw src/items.json
|
||||
work/store.coffee: work src/backbonestore.nw
|
||||
$(NOTANGLE) -c -Rstore.coffee src/backbonestore.nw > work/store.coffee
|
||||
|
||||
htdocs/data/items.json: src/items.json
|
||||
mkdir -p htdocs/data
|
||||
cp src/items.json htdocs/data/items.json
|
||||
|
||||
.nw.tex:
|
||||
$(NOWEAVE) -x -delay $*.nw > $*.tex
|
||||
|
||||
|
|
53
index.haml
53
index.haml
|
@ -1,53 +0,0 @@
|
|||
!!! 5
|
||||
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
|
||||
%head
|
||||
%title The Backbone Store
|
||||
%link{:charset => "utf-8", :href => "jsonstore.css", :rel => "stylesheet", :type => "text/css"}/
|
||||
%script#store_index_template(type="text/x-underscore-tmplate")
|
||||
%h1 Product Catalog
|
||||
%ul
|
||||
<% for(i=0,l=products.length;i<l;++i) { p = products[i]; %>
|
||||
%li.item
|
||||
.item-image
|
||||
%a{:href => "#item/<%= p.id %>"}
|
||||
%img{:src => "<%= p.image %>", :alt => "<%= p.title %>"}/
|
||||
.item-artist <%= p.artist %>
|
||||
.item-title <%= p.title %>
|
||||
.item-price $<%= p.price %>
|
||||
<% } %>
|
||||
|
||||
%script#store_item_template(type= "text/x-underscore-template")
|
||||
.item-detail
|
||||
.item-image
|
||||
%img(src="<%= large_image %>" alt="<%= title %>")/
|
||||
.item-info
|
||||
.item-artist <%= artist %>
|
||||
.item-title <%= title %>
|
||||
.item-price $<%= price %>
|
||||
.item-form
|
||||
%form(action="#/cart" method="post")
|
||||
%p
|
||||
%label Quantity:
|
||||
%input(type="text" size="2" name="quantity" value="1" class="uqf")/
|
||||
%p
|
||||
%input(type="submit" value="Add to Cart" class="uq")/
|
||||
|
||||
.item-link
|
||||
%a(href="<%= url %>") Buy this item on Amazon
|
||||
.back-link
|
||||
%a(href="#") « Back to Items
|
||||
%script#store_cart_template(type="text/x-underscore-template")
|
||||
%p Items: <%= count %> ($<%= cost %>)
|
||||
|
||||
</head>
|
||||
%body
|
||||
#container
|
||||
#header
|
||||
%h1
|
||||
The Backbone Store
|
||||
.cart-info
|
||||
#main
|
||||
%script{:src => "jquery-1.6.2.min.js", :type => "text/javascript"}
|
||||
%script{:src => "underscore.js", :type => "text/javascript"}
|
||||
%script{:src => "backbone.js", :type => "text/javascript"}
|
||||
%script{:src => "store.js", :type => "text/javascript"}
|
|
@ -1,84 +0,0 @@
|
|||
rounded(radius)
|
||||
-moz-border-radius-topleft: radius
|
||||
-moz-border-radius-topright: radius
|
||||
-moz-border-radius-bottomleft: radius
|
||||
-moz-border-radius-bottomright: radius
|
||||
-webkit-border-bottom-right-radius: radius
|
||||
-webkit-border-top-left-radius: radius
|
||||
-webkit-border-top-right-radius: radius
|
||||
-webkit-border-bottom-left-radius: radius
|
||||
border-bottom-right-radius: radius
|
||||
border-top-left-radius: radius
|
||||
border-top-right-radius: radius
|
||||
border-bottom-left-radius: radius
|
||||
|
||||
background_gradient(base)
|
||||
background: base
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(lighten(base, 20%)), to(darken(base, 20%)))
|
||||
background: -moz-linear-gradient(top, lighten(base, 20%), darken(base, 20%))
|
||||
|
||||
body
|
||||
font-family: "Lucida Grande", Lucida, Helvetica, Arial, sans-serif
|
||||
background: #FFF
|
||||
color: #333
|
||||
margin: 0px
|
||||
padding: 0px
|
||||
|
||||
|
||||
#header
|
||||
background_gradient(#999)
|
||||
margin: 0px
|
||||
padding: 20px
|
||||
border-bottom: 1px solid #ccc
|
||||
|
||||
h1
|
||||
font-family: Inconsolata, Monaco, Courier, mono
|
||||
color: #FFF
|
||||
margin: 0px
|
||||
|
||||
.cart-info
|
||||
position: absolute
|
||||
top: 0px
|
||||
right: 0px
|
||||
text-align: right
|
||||
padding: 10px
|
||||
background_gradient(#555)
|
||||
color: #FFF
|
||||
font-size: 12px
|
||||
font-weight: bold
|
||||
|
||||
img
|
||||
border: 0
|
||||
|
||||
#productlistview
|
||||
ul
|
||||
list-style: none
|
||||
|
||||
.item
|
||||
float:left
|
||||
width: 250px
|
||||
margin-right: 10px
|
||||
margin-bottom: 10px
|
||||
padding: 5px
|
||||
rounded(5px)
|
||||
border: 1px solid #ccc
|
||||
text-align:center
|
||||
font-size: 12px
|
||||
|
||||
.item-title
|
||||
font-weight: bold
|
||||
|
||||
.item-artist
|
||||
font-weight: bold
|
||||
font-size: 14px
|
||||
|
||||
.item-detail
|
||||
margin: 10px 0 0 10px
|
||||
|
||||
.item-image
|
||||
float:left
|
||||
margin-right: 10px
|
||||
|
||||
.item-info
|
||||
padding: 100px 10px 0px 10px
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "the-backbone-store",
|
||||
"version": "3.0.1",
|
||||
"description": "A comprehensive (one hopes) tutorial on a simple development platform for Backbone.",
|
||||
"main": "htdocs/index.html",
|
||||
"dependencies": {
|
||||
"http-server": "^0.9.0",
|
||||
"coffee-script": "^1.10.0",
|
||||
"stylus": "^0.54.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"inotify": "^1.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make serve"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/elfsternberg/The-Backbone-Store.git"
|
||||
},
|
||||
"keywords": [
|
||||
"backbone",
|
||||
"javascript",
|
||||
"makefiles",
|
||||
"node",
|
||||
"coffee",
|
||||
"haml",
|
||||
"stylus",
|
||||
"tutorial"
|
||||
],
|
||||
"author": "Kenneth M. \"Elf\" Sternberg <elf.sternberg@gmail.com>",
|
||||
"license": "BSD-2-Clause",
|
||||
"bugs": {
|
||||
"url": "https://github.com/elfsternberg/The-Backbone-Store/issues"
|
||||
},
|
||||
"homepage": "https://github.com/elfsternberg/The-Backbone-Store#readme"
|
||||
}
|
Loading…
Reference in New Issue