Skip to content

Commit

Permalink
Added hogan. bugfix on build.
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton committed Jun 26, 2012
1 parent dd3a9ca commit 7cbe4a3
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
22 changes: 18 additions & 4 deletions assets/Makefile
@@ -1,6 +1,12 @@
ifdef extra_makefile
include $(extra_makefile)
endif
#ifdef extra_makefile
# include $(extra_makefile)
#endif


${build_path}/%.js: %.coffee
mkdir -p `dirname $@`
coffee -o `dirname $@` -c $^


${build_path}/%.html.copy: %.html
mkdir -p `dirname $@`
Expand Down Expand Up @@ -28,7 +34,6 @@ ${build_path}/%.js: %.ls
mkdir -p `dirname $@`
livescript -c $^


##############################
# Uglify-js
# (.js) -> (.min.js)
Expand All @@ -46,6 +51,15 @@ ${build_path}/%.css: %.less
mkdir -p `dirname $@`
lessc $^ $@

##############################
# Less CSS
# (.less) -> (.css)
${build_path}/%.js: %.mustaches
${build_path}/%.js: %.mustache
${build_path}/%.js: %.hogan
mkdir -p `dirname $@`
hulk $^ > $@

##############################
# Sass
# (.scss) -> (.css)
Expand Down
6 changes: 3 additions & 3 deletions lib/builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/server.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "readymade"
, "description": "Asset server based on Make : supports less, coffeescript, coco, livescript, sass, uglifyjs, markdown."
, "version": "0.1.1"
, "version": "0.2.0"
, "author": "Paul Masurel <paul.masurel@gmail.com>"
, "private": false
, "engines": ["node >= 0.4.0"]
Expand Down
6 changes: 4 additions & 2 deletions src/builder.coffee
Expand Up @@ -17,13 +17,15 @@ ASSET_PATH = path.join __dirname, '../assets/'
ENVIRONMENT = extend {}, process.env, 'ASSET_PATH': ASSET_PATH
ENVIRONMENT.PATH = (ENVIRONMENT.PATH ? "") + ":" + NODE_BIN_PATH


DEFAULT_MAKEFILE_PATH = path.join __dirname, '../assets/Makefile'

class Builder

constructor: (@parameters)->

build: (target, success, failure)->
build: (rel_path, success, failure)->
target = path.join @parameters.build_path, rel_path
make_argv = [ '-f', DEFAULT_MAKEFILE_PATH, target ]
ENVIRONMENT.build_path = @parameters.build_path
if @parameters.makefile_path?
Expand All @@ -48,7 +50,7 @@ class Builder
failure()
pop_and_build_one = =>
if target = targets.shift()
terminal.write(rjust(target, 30))
terminal.write rjust(target, 30)
@build target, build_success, build_failure
else
success()
Expand Down
4 changes: 2 additions & 2 deletions src/server.coffee
Expand Up @@ -59,7 +59,7 @@ class Server
response.setHeader "Access-Control-Allow-Origin", "*"
url = request.url
url_base = url.split('?', 1)[0]
target = path.join @build_path, url_base
rel_path = path.join ".", url_base
serve_file = (target)->
terminal.color(style.GET).write('GET ').reset()
terminal.color(style.TARGET).write(url).nl().reset()
Expand All @@ -73,7 +73,7 @@ class Server
response.end TEMPLATES.error404
filepath: target
error_msg: error_msg
@builder.build target, serve_file, failure_callback
@builder.build rel_path, serve_file, failure_callback


url: ->
Expand Down

0 comments on commit 7cbe4a3

Please sign in to comment.