-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·3 lines (3 loc) · 1.88 KB
/
index.js
1
2
3
#!/usr/bin/env node
"use strict";var y=require("fs");var c=require("fs/promises"),p=require("./node_modules/less/index.js"),a=async e=>{try{let t=await(0,c.readFile)(e),o=await(0,p.render)(t.toString());console.log(o.css)}catch(t){console.error(t.message),process.exit(1)}};var m=require("fs/promises"),u=require("./node_modules/pug/lib/index.js"),S=require("./node_modules/pretty/index.js"),k=require("./node_modules/remark-parse/index.js"),q=require("./node_modules/remark-rehype/index.js"),b=require("./node_modules/rehype-stringify/index.js"),h=require("./node_modules/unified/index.js"),l=async(e,t)=>{let o=h().use(k).use(q).use(b),i=await(0,m.readFile)(e),s=(await o.process(i.toString())).contents;if(t){let w=(0,u.compileFile)(t)().replace("BLOCK_CONTENT",s),O=S(w);console.log(O)}else console.log(s)};var g=require("fs/promises"),f=require("./node_modules/pug/lib/index.js"),x=require("./node_modules/pretty/index.js"),v=async e=>{if(e){let t=await(0,g.readFile)(e);return JSON.parse(t.toString())}return{}},d=async(e,t)=>{try{let o=await v(t),i=(0,f.compileFile)(e)(o),n=x(i);console.log(n)}catch(o){console.error(o.message),process.exit(1)}};var N=require("path/posix"),r=require("./node_modules/commander/index.js"),j=()=>{let e=N.join(__dirname,"package.json");return JSON.parse((0,y.readFileSync)(e).toString())};r.name("bssg").description("Brad's Static Website Generator").version(j().version);r.command("lessc").description("compile a less file").argument("<input-file>","less file to compile").action(a);r.command("markdownc").description("compile a markdown file").argument("<input-file>","pug file to inject content into").argument("[extends-file]","pug file to extend from").action(l);r.command("pugc").description("compile a pug file").argument("<input-file>","pug file to inject content into").argument("[locals-file]","JSON file for locals").action(d);r.parse();
//# sourceMappingURL=index.js.map