JSDocument!
An Library for create page from node.js.
how to use:
var JSDocument = require('jsdocument') // Load Library
var document = new JSDocument.JSDocument() // New Page!
You created page, but it not running for now.
JSDocument.Server.SetResponseHandler('/' , function(){ // '/' means address
return [document.GetRawHTML(), "html"] // returns raw html and type to server
}) // '/' - path, function() - handler
Server is now Running!
.....
but empty?
No, you can create objects!
new JSDocument.JSObjects.JSTitleObject() // creates new title object
new JSDocument.JSObjects.JSScriptObject() // creates new script object
new JSDocument.JSObjects.JSLinkObject(href, rel) // creates new link object (for linking css)
new JSDocument.JSObjects.JSObject() // creates new div object
new JSDocument.JSObjects.JSStyleObject() // creates new html-tag css object
new JSDocument.JSObjects.JSVideoObject() // creates new HTML5 video tag
... // and more!
document.AddObject(Object) // adds object on body tag
document.AddHeaderObject(Object) // adds object on head tag, use on title tag or script tag.
Options:
object.Attributes // < div (here) >
object.ObjectType // Always 'JSDocument'
object.SetType(new type) // Changes Type (ex: new JSDocument.JSObjects.JSObject().SetType("h1"))
object.Text // innerHTML
object.Type // HTML Object Type
object.id // HTML element id
object.class // HTML Class name
object.AddObject(other object) // adds object on object
Wait, you want use favicon and css?
CSS -
JSDocument.UseCSS(document object, css name (ex. 'index.css'), Server Object)
Favicon -
JSDocument.UseIcon(document object, favicon name (ex. 'favicon.ico'), Server Object)
but, like JSVideoObject, some object needs file.
Simple!
JSDocument.AddRef(document object, file name, Server Object)
and now you can use that file.
new JSDocument.JSPage(server object)
Same as JSDocument.JSDocument, but little diffrents.first, you need to use JSPage.GetJSDocumentObject() in addref, useicon, usecss.
next, you can use JSPage.Deploy( address ).
three, not uses JSTitleObject from JSObjects, it uses JSPage.SetTitle(title)!
All-In-one
JSDocument Github