Skip to content

Commit

Permalink
'compiled' > 'result'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Escalante committed Nov 11, 2014
1 parent 38ce3aa commit 3707026
Show file tree
Hide file tree
Showing 22 changed files with 118 additions and 120 deletions.
6 changes: 2 additions & 4 deletions lib/adapter_base.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ class Adapter
* @return {Promise}
###
render: (str, opts = {}) ->
if not @_render
return W.reject new Error('render not supported')
if not @_render then return W.reject new Error('render not supported')
@_render(str, opts)

###*
Expand All @@ -107,8 +106,7 @@ class Adapter
* @return {Promise}
###
compile: (str, opts = {}) ->
if not @_compile
return W.reject new Error('compile not supported')
if not @_compile then return W.reject new Error('compile not supported')
@_compile(str, opts)

###*
Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/LiveScript.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class LiveScript extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = LiveScript
2 changes: 1 addition & 1 deletion lib/adapters/coco.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class Coco extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = Coco
4 changes: 2 additions & 2 deletions lib/adapters/coffee-script.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class CoffeeScript extends Adapter
try res = fn()
catch err then return W.reject(err)
if res.sourceMap
W.resolve(compiled: res.js, sourcemap: res.sourceMap, v3sourcemap: res.v3SourceMap)
W.resolve(result: res.js, sourcemap: res.sourceMap, v3sourcemap: res.v3SourceMap)
else
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = CoffeeScript
2 changes: 1 addition & 1 deletion lib/adapters/csso.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class CSSO extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = CSSO
2 changes: 1 addition & 1 deletion lib/adapters/dogescript.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class DogeScript extends Adapter
isolated: true

_render: (str, options) ->
W.resolve(compiled: @engine(str, options.beauty, options.trueDoge))
W.resolve(result: @engine(str, options.beauty, options.trueDoge))

module.exports = DogeScript
2 changes: 1 addition & 1 deletion lib/adapters/ejs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class EJS extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = EJS
2 changes: 1 addition & 1 deletion lib/adapters/haml.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ class HAML extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = HAML
2 changes: 1 addition & 1 deletion lib/adapters/handlebars.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ class Handlebars extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = Handlebars
2 changes: 1 addition & 1 deletion lib/adapters/jade.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ class Jade extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = Jade
2 changes: 1 addition & 1 deletion lib/adapters/less.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Less extends Adapter

@engine.render str, options, (err, res) ->
if err then return deferred.reject(err)
obj = { compiled: res.css }
obj = { result: res.css }
if options.sourceMap then obj.sourcemap = res.map
deferred.resolve(obj)

Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/marc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ class Marc extends Adapter

# all the remaining options are options for marked
base.config options
W.resolve(compiled: base(str, true))
W.resolve(result: base(str, true))

module.exports = Marc
2 changes: 1 addition & 1 deletion lib/adapters/markdown.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ class Markdown extends Adapter

_render: (str, options) ->
nodefn.call(@engine.bind(@engine), str, options)
.then (res) -> compiled: res
.then (res) -> result: res

module.exports = Markdown
2 changes: 1 addition & 1 deletion lib/adapters/minify-css.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ class MinifyCSS extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = MinifyCSS
2 changes: 1 addition & 1 deletion lib/adapters/minify-html.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class MinifyHTML extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = MinifyHTML
2 changes: 1 addition & 1 deletion lib/adapters/minify-js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MinifyJS extends Adapter
_render: (str, options) ->
compile =>
res = @engine.minify(str, _.extend(options, fromString: true))
obj = { compiled: res.code }
obj = { result: res.code }
if options.sourceMap then obj.sourcemap = res.map
obj

Expand Down
4 changes: 2 additions & 2 deletions lib/adapters/mustache.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Mustache extends Adapter

_compileClient: (str, options) ->
options.asString = true
@_compile(str, options).then((o) -> compiled: "new Hogan.Template(#{o.compiled.toString()});")
@_compile(str, options).then((o) -> result: "new Hogan.Template(#{o.result.toString()});")

clientHelpers: ->
version = require(path.join(@engine.__accord_path, 'package')).version
Expand All @@ -33,6 +33,6 @@ class Mustache extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = Mustache
2 changes: 1 addition & 1 deletion lib/adapters/myth.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class Myth extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = Myth
4 changes: 2 additions & 2 deletions lib/adapters/scss.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class SCSS extends Adapter
deferred = W.defer()

options.data = str
options.success = (res) -> deferred.resolve(compiled: res)
options.error = (res) -> deferred.reject(compiled: res)
options.success = (res) -> deferred.resolve(result: res)
options.error = (res) -> deferred.reject(result: res)

@engine.render(options)

Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/stylus.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Stylus extends Adapter

nodefn.call(base.render.bind(base))
.then (res) ->
obj = { compiled: res }
obj = { result: res }
if base.sourcemap then obj.sourcemap = base.sourcemap
return obj

Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/swig.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ class Swig extends Adapter
compile = (fn) ->
try res = fn()
catch err then return W.reject(err)
W.resolve(compiled: res)
W.resolve(result: res)

module.exports = Swig
Loading

0 comments on commit 3707026

Please sign in to comment.