-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
The main problem of node.js apps are nested callbacks. You use them A LOT everywhere. Code becomes like a ladder etc. I propose to add a simple operator for their handling.
With "<-" operator, these two snippets of code would be identical. Coco had already added this thing and it's very comfortable / easy-to-use.
(found) <- path.exists mainFilePath
return unless found
(error, data) <- fs.readFile mainFilePath, "utf8"
return helpers.logError error if error
compiler = stylus(data)
.set("filename", mainFilePath)
.set("compress", true)
.include(@getPath "src")
compiler.use nib if nib
(error, css) <- compiler.render
return helpers.logError error if error
mainCss = @getBuildPath "web/css/main.css"
(error) <- fs.writeFile mainCss, css, "utf8"
return helpers.logError error if error
helpers.logSuccess "[Stylus]: compiled main.css."path.exists mainFilePath, (found) ->
return unless found
fs.readFile mainFilePath, "utf8", (error, data) ->
return helpers.logError error if error
compiler = stylus(data)
.set("filename", mainFilePath)
.set("compress", true)
.include(@getPath "src")
compiler.use nib if nib
compiler.render (error, css) ->
return helpers.logError error if error
mainCss = @getBuildPath "web/css/main.css"
fs.writeFile mainCss, css, "utf8", (error) ->
return helpers.logError error if error
helpers.logSuccess "[Stylus]: compiled main.css."