Skip to content

Commit

Permalink
Merge 6b89761 into 7b25a89
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Escalante committed Dec 19, 2014
2 parents 7b25a89 + 6b89761 commit cc585af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions lib/compiler.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CompileFile
.then((o) => @content = o)
.then(=> sequence(hooks('compile_hooks.before_file'), @))
.then(each_pass)
.tap((o) => @content = o)
.tap((o) => @content = o.result)
.tap(=> @roots.emit('compile', @file))
.then(=> sequence(hooks('compile_hooks.after_file'), @))
.then(write_file)
Expand Down Expand Up @@ -243,7 +243,7 @@ class CompileFile

each_pass = ->
pass = new CompilePass(@)
pipeline(@adapters.map((a,i) -> pass.run.bind(pass, a, i + 1)), @content)
pipeline(@adapters.map((a,i) -> pass.run.bind(pass, a, i + 1)), { result: @content })

###*
* Returns the absolute path to the file as requested through the browser,
Expand Down Expand Up @@ -292,16 +292,23 @@ class CompilePass
* @todo is there a way to yield(@content)?
###

run: (@adapter, @index, @content) ->
run: (@adapter, @index, @input) ->
hooks = (cat) => @file.extensions.hooks(cat, @file.category)

@content = @input.result

sequence(hooks('compile_hooks.before_pass'), @)
.with(@)
.tap(=> @opts = configure_options.call(@))
.then(compile_or_pass)
.then((o) => @content = o)
.then(=> sequence(hooks('compile_hooks.after_pass'), @))
.then(=> @content)
.then (o) =>
@content = o.result
res = { result: @content }
if o.sourcemap
@sourcemap = o.sourcemap
res.sourcemap = @sourcemap
return res
.tap(=> sequence(hooks('compile_hooks.after_pass'), @))

###*
* This function is responsible for getting all the options together for the
Expand Down Expand Up @@ -345,5 +352,5 @@ class CompilePass
###

compile_or_pass = ->
if not @adapter.name then return @content
if not @adapter.name then return @input
@adapter.render(@content, @opts)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"doc": "doc"
},
"dependencies": {
"accord": "0.12.x",
"accord": "0.13.x",
"argparse": "0.1.x",
"charge": "0.0.3",
"chokidar": "0.9.x",
Expand Down

0 comments on commit cc585af

Please sign in to comment.