Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fs = require("fs-extra")
- pogoCompile = require("./pogo-through")
- through = require("through")
- pogoFileToJsFile = (file) ->
- split = file.split(".")
- split.splice(0, split.length-1).join(".") + ".js"
- # Recursively compile all .pogo files from src directory to lib directory
- pogoC = ->
- readdirp = require("readdirp")
- readdirp(
- root: "./src"
- fileFilter: "*.pogo"
- ).on "data", (entry) ->
- write = (buf) ->
- data += buf
- end = ->
- fs.outputFile fileOut, data, (err) ->
- throw err if err
- file = "./src/" + entry.path
- fileOut = "./lib/" + pogoFileToJsFile(entry.path)
- data = ""
- fs.createReadStream(file).pipe(pogoCompile(file)).pipe through(write, end)
- module.exports = pogoC
Advertisement
Add Comment
Please, Sign In to add comment