{"_id":"coffee-views","_rev":"41-9148ec73f5d810fa7e25e8bca3343dcd","name":"coffee-views","description":"An OOP extension to coffee-templates","dist-tags":{"latest":"5.3.0"},"versions":{"0.0.1":{"name":"coffee-views","version":"0.0.1","description":"An OOP extension to coffee-templates","main":"index.coffee","scripts":{"test":"nodeunit test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-templates-express.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"*","express":"*","nodeunit":"*","expect.js":"*","sinon":"*"},"dependencies":{"coffee-templates":"0.0.6","underscore":"~1.4.4"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views is an extension to [coffee-templates](https://github.com/mikesmullin/coffee-templates) adding template inheritance and an express.js engine.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view\r\n  render: ->\r\n    doctype 5\r\n    html ->\r\n\r\n      head ->\r\n        title @title\r\n        @stylesheets()\r\n\r\n      body ->\r\n        h1 @title\r\n        @content()\r\n\r\n  stylesheets: ->\r\n  \r\n  content: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n\r\n  content: ->\r\n    div ->\r\n      p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View title: 'My Site'\r\n\r\nconsole.log view.render()\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nDue to the nature of coffee-templates, CoffeeScript's native `super()` method cannot be used. Instead, you can use a `parent([methodName])` function:\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  content: ->\r\n    literal parent 'content'\r\n    div ->\r\n      p 'This is an extension to \"MyView\"'\r\n```\r\n\r\n","_id":"coffee-views@0.0.1","dist":{"shasum":"905c2a7fcc7933d513905429b6c27c8e7ae2ded9","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-0.0.1.tgz","integrity":"sha512-6U5cs/lKV2PH+QWchY6SzFfec777VONpqNxxDYywii2/truPmttaRFJbr6IYw7A2dINcw8d5xSzJ3PwWk2aYTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG6jHy6piP/NJenCS9sJKbdcvTzc/IS5JWd6cs9lJO54AiArzQ3FUXXnw/XwZB4khq/h9BZIr6hDz7pQ+uSyjhChbQ=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"0.0.3":{"name":"coffee-views","version":"0.0.3","description":"An OOP extension to coffee-templates","main":"index.coffee","scripts":{"test":"nodeunit test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-templates-express.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"*","express":"*","nodeunit":"*","expect.js":"*","sinon":"*"},"dependencies":{"coffee-templates":"0.0.6","underscore":"~1.4.4"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views is an extension to [coffee-templates](https://github.com/mikesmullin/coffee-templates) adding template inheritance and an express.js engine.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view\r\n  render: ->\r\n    doctype 5\r\n    html ->\r\n\r\n      head ->\r\n        title @title\r\n        @stylesheets()\r\n\r\n      body ->\r\n        h1 @title\r\n        @content()\r\n\r\n  stylesheets: ->\r\n  \r\n  content: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n\r\n  content: ->\r\n    div ->\r\n      p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View title: 'My Site'\r\n\r\nconsole.log view.render()\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nDue to the nature of coffee-templates, CoffeeScript's native `super()` method cannot be used. Instead, you can use a `parent()` function:\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  content: ->\r\n    literal parent()\r\n    div ->\r\n      p 'This is an extension to \"MyView\"'\r\n```\r\n\r\n","_id":"coffee-views@0.0.3","dist":{"shasum":"573ac8ab06f92c6cf3072b12dedabe0e14a7e0d6","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-0.0.3.tgz","integrity":"sha512-9YNG/l0hF7w0xejxuh7xH+8bul1fGvfNSRfp1AWWHZXty9qtMSs4G+Ag6tkLIn6PswIn2eGW7a6OsIDFPu8mmw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4bbhMDDuFrMuyfxal6PTCcWrlUl03E/FxJt2rAQv2bgIgOUBItI9T8MqXH7fsVA4ulxFWOgWJtUAnl7tE061LTho="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"0.1.0":{"name":"coffee-views","version":"0.1.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-templates-express.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"coffee-templates":"0.0.6","underscore":"~1.4.4"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views is an extension to [coffee-templates](https://github.com/mikesmullin/coffee-templates) adding template inheritance and an express.js engine.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view in express\r\n  render: ->\r\n    doctype 5\r\n    html ->\r\n\r\n      head ->\r\n        title @title\r\n        @stylesheets()\r\n\r\n      body ->\r\n        h1 @title\r\n        @content()\r\n\r\n  stylesheets: ->\r\n  \r\n  content: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n  content: ->\r\n    div ->\r\n      p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View title: 'My Site'\r\n\r\nconsole.log view.render()\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My Site</title>\r\n  </head>\r\n  <body>\r\n    <h1>My Site</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  content: ->\r\n    literal super()\r\n    div ->\r\n      p 'This is an extension to \"MyView\"'\r\n\r\nview = new MyExtendedView title: 'My extended view'\r\nconsole.log view.render()\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My extended view</title>\r\n  </head>\r\n  <body>\r\n    <h1>My extended view</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n    <div>\r\n      <p>This is an extension to \"MyView\"</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\n","_id":"coffee-views@0.1.0","dist":{"shasum":"24ebfa7a7e436f1b6870a5cf0f3e8f3e432b9e40","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-0.1.0.tgz","integrity":"sha512-OtfEH6ebwaHdFcwDDvPhv87QXIyk36/tp2ZW2vauRm2pq3wyuSzCRUfPWIEPk5uQsgxlV9w5KTccspJ0q3nB0g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXQlY7js+KMaMEJ+antiQcoD9nhv/eUtUBNVHCqgrGpgIhAIyfpie3DKGUSE0g9XbpQBQzoKiDnaJFEXUFq4cWmRtf"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"0.1.1":{"name":"coffee-views","version":"0.1.1","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"coffee-templates":"0.0.6","underscore":"~1.4.4"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views is an extension to [coffee-templates](https://github.com/mikesmullin/coffee-templates) adding template inheritance and an express.js engine.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view in express\r\n  render: ->\r\n    doctype 5\r\n    html ->\r\n\r\n      head ->\r\n        title @title\r\n        @stylesheets()\r\n\r\n      body ->\r\n        h1 @title\r\n        @content()\r\n\r\n  stylesheets: ->\r\n  \r\n  content: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n  content: ->\r\n    div ->\r\n      p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View title: 'My Site'\r\n\r\nconsole.log view.render()\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My Site</title>\r\n  </head>\r\n  <body>\r\n    <h1>My Site</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  content: ->\r\n    literal super()\r\n    div ->\r\n      p 'This is an extension to \"MyView\"'\r\n\r\nview = new MyExtendedView title: 'My extended view'\r\nconsole.log view.render()\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My extended view</title>\r\n  </head>\r\n  <body>\r\n    <h1>My extended view</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n    <div>\r\n      <p>This is an extension to \"MyView\"</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nPlain ol' JavaScript\r\n--------------------\r\n\r\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\r\n\r\n```javascript\r\n// layout.js\r\nvar Base = require('coffee-views').Base,\r\n    util = require('util');\r\n\r\nfunction Layout(){}\r\nmodule.exports = Layout;\r\nutil.inherits(Layout, Base);\r\n\r\nLayout.prototype.render = function(){\r\n  doctype(5);\r\n  head(function(){\r\n    title(this.title);\r\n    this.stylesheets();\r\n  });\r\n  body(function(){\r\n    h1(this.title);\r\n    this.content();\r\n  });\r\n};\r\n\r\nLayout.prototype.stylesheets = function(){};\r\nLayout.prototype.content = function(){};\r\n```\r\n\r\n```javascript\r\n// myview.js\r\nvar Layout = require('./layout'),\r\n    util = require('util');\r\n\r\nfunction MyExtendedView(){}\r\nmodule.exports = MyExtendedView;\r\nutil.inherits(MyExtendedView, Layout);\r\n\r\nMyView.prototype.content = function(){\r\n  div(function(){\r\n    p('My content');\r\n  });\r\n};\r\n```\r\n\r\n```javascript\r\n// extendedview.js\r\nvar MyView = require('./myview'),\r\n    util = require('util');\r\n\r\nfunction ExtendedView(){}\r\nmodule.exports = ExtendedView;\r\nutil.inherits(ExtendedView, MyView);\r\n\r\nExtendedView.prototype.content = function(){\r\n  // When overriding methods, you must not refer to the base\r\n  // class directly. This will not work due to the nature of\r\n  // coffee-templates. Therefore, refer to the \"super_\" property.\r\n  literal(ExtendedView.super_.prototype.content.call(this));\r\n  div(function(){\r\n    p('Native extensions');\r\n  });\r\n};\r\n```\r\n\r\n","_id":"coffee-views@0.1.1","dist":{"shasum":"041d7de0d3ae407656fde25e89531285d7b0b9b4","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-0.1.1.tgz","integrity":"sha512-BuJajbJd4yVa+bnRp9ATQLJA7saheyjiJjGp3NCM/FLTRDH/ICNcgsFRa3OjubeX7nQaKQyXOKyJ7r/0YuwPwg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCT+4WrpVXOhZrHm14V3truULn7UfzcvrPo3KKXkATsLgIhAOq+rNytaNG8ST9O0ZaVNHqrvhPchVm/qWv0raRDvveK"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"1.0.0":{"name":"coffee-views","version":"1.0.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view in express.\r\n  render: (options)->\r\n    @doctype 5\r\n    @html ->\r\n\r\n      @head ->\r\n        @title options.title\r\n        @stylesheetBlock()\r\n\r\n      @body ->\r\n        @h1 options.title\r\n        @contentBlock()\r\n\r\n  stylesheetBlock: ->\r\n  \r\n  contentBlock: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n  contentBlock: ->\r\n    @div ->\r\n      @p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View()\r\n\r\nconsole.log view.compile 'render', title: 'My Site'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My Site</title>\r\n  </head>\r\n  <body>\r\n    <h1>My Site</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  contentBlock: ->\r\n    super\r\n    @div ->\r\n      @p 'This is an extension to \"MyView\"'\r\n\r\nview = new MyExtendedView() \r\nconsole.log view.compile 'render', title: 'My extended view'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My extended view</title>\r\n  </head>\r\n  <body>\r\n    <h1>My extended view</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n    <div>\r\n      <p>This is an extension to \"MyView\"</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nPlain ol' JavaScript\r\n--------------------\r\n\r\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\r\n\r\n```javascript\r\n// layout.js\r\nvar Base = require('coffee-views').Base,\r\n    util = require('util');\r\n\r\nfunction Layout(){}\r\nmodule.exports = Layout;\r\nutil.inherits(Layout, Base);\r\n\r\nLayout.prototype.render = function(options){\r\n  this.doctype(5);\r\n  this.head(function(){\r\n    this.title(options.title);\r\n    this.stylesheetBlock();\r\n  });\r\n  this.body(function(){\r\n    this.h1(options.title);\r\n    this.contentBlock();\r\n  });\r\n};\r\n\r\nLayout.prototype.stylesheetBlock = function(){};\r\nLayout.prototype.contentBlock = function(){};\r\n```\r\n\r\n```javascript\r\n// myview.js\r\nvar Layout = require('./layout'),\r\n    util = require('util');\r\n\r\nfunction MyExtendedView(){}\r\nmodule.exports = MyExtendedView;\r\nutil.inherits(MyExtendedView, Layout);\r\n\r\nMyView.prototype.contentBlock = function(){\r\n  this.div(function(){\r\n    this.p('My content');\r\n  });\r\n};\r\n```\r\n\r\n```javascript\r\n// extendedview.js\r\nvar MyView = require('./myview'),\r\n    util = require('util');\r\n\r\nfunction ExtendedView(){}\r\nmodule.exports = ExtendedView;\r\nutil.inherits(ExtendedView, MyView);\r\n\r\nExtendedView.prototype.contentBlock = function(){\r\n  ExtendedView.super_.prototype.contentBlock.call(this);\r\n  this.div(function(){\r\n    this.p('Native extensions');\r\n  });\r\n};\r\n```\r\n\r\n","_id":"coffee-views@1.0.0","dist":{"shasum":"60f6c886abfa74b52841767d1a9d80d0910a60d4","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-1.0.0.tgz","integrity":"sha512-xzGH/LnpkGC/aWDa7MZoeMz5RL2x7KMnWWrewMkJrJHx5BPOjvJ4wTMYq3BTLDBlQMkEySfEMKNnNRqAEuAEkg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3Nlw4cntOhp6SEBdINs0kVE3bITQUFnyIMV91sXYuwAIgRneZhYnFQee7W7cO7NSZ84dnbRUeXUe2uHaP1a7xooo="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"1.1.0":{"name":"coffee-views","version":"1.1.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Base} = require 'coffee-views'\n\nmodule.exports = class Layout extends Base\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\n\nconsole.log view.compile 'render', title: 'My Site'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My Site</title>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Base = require('coffee-views').Base,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Base);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The CoffeeScript Tag\n\nUsing the `Renderer#coffeescript()` function will create a `<script>` tag with compiled JavaScript:\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: ->\n    @coffeescript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>(function () {\n          alert('Yay! CoffeeScript!');\n        }).call(this)</script>\n###\n```\n\n### The Literal Tag\n\nUsing the `Renderer#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n\n","_id":"coffee-views@1.1.0","dist":{"shasum":"ffc526c7e39f9a6d6c6556545718eb71bbbbe177","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-1.1.0.tgz","integrity":"sha512-cCkBx/taeFzQLC6SZJD4YaLW+UfdWN1gO8ySi55l/+RMhR3CreRBezyFwY4s1Cbi0+Lcem01sYwBiu5qVL9kAQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnMrP2JqrmQbUmwm2RPjvTeRzfz5ybc89EZ7ptapEmXwIhAOzp2UD9ShsfIHuCwhLt2VeZczIBz2jr1ryLvmjxBbgA"}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"2.0.0":{"name":"coffee-views","version":"2.0.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Base} = require 'coffee-views'\n\nmodule.exports = class Layout extends Base\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\n\nconsole.log view.compile 'render', title: 'My Site'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My Site</title>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Base = require('coffee-views').Base,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Base);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The Script Tag\n\nUsing the `Renderer#script()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: ->\n    @script ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>(function () {\n          alert('Yay! CoffeeScript!');\n        }).call(this)</script>\n###\n```\n\n### The Literal Tag\n\nUsing the `Renderer#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n\n","_id":"coffee-views@2.0.0","dist":{"shasum":"6312e66dfb8a9419e90ccbe5028b3c79e294bc0f","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-2.0.0.tgz","integrity":"sha512-E4LZW75Bg7ERw1pWqwLh6G4SqIo24v9FacnyrrLdOGWpGy5WYguDe++yEtLLIgesl9GiR0h5ELJyAT2NiAHbBQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCihQWmXihf38iIopHrzfaktrnZuVpbFktO1PETI/vDNgIhAOZcH2N9gG30uVLjgtJ1djXK3yFFUtmBuU4KW6QjyxYl"}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"2.0.1":{"name":"coffee-views","version":"2.0.1","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view in express.\r\n  render: (options)->\r\n    @doctype 5\r\n    @html ->\r\n\r\n      @head ->\r\n        @title options.title\r\n        @stylesheetBlock()\r\n\r\n      @body ->\r\n        @h1 options.title\r\n        @contentBlock()\r\n\r\n  stylesheetBlock: ->\r\n  \r\n  contentBlock: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n  contentBlock: ->\r\n    @div ->\r\n      @p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View()\r\n\r\nconsole.log view.compile 'render', title: 'My Site'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My Site</title>\r\n  </head>\r\n  <body>\r\n    <h1>My Site</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  contentBlock: ->\r\n    super\r\n    @div ->\r\n      @p 'This is an extension to \"MyView\"'\r\n\r\nview = new MyExtendedView() \r\nconsole.log view.compile 'render', title: 'My extended view'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My extended view</title>\r\n  </head>\r\n  <body>\r\n    <h1>My extended view</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n    <div>\r\n      <p>This is an extension to \"MyView\"</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nPlain ol' JavaScript\r\n--------------------\r\n\r\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\r\n\r\n```javascript\r\n// layout.js\r\nvar Base = require('coffee-views').Base,\r\n    util = require('util');\r\n\r\nfunction Layout(){}\r\nmodule.exports = Layout;\r\nutil.inherits(Layout, Base);\r\n\r\nLayout.prototype.render = function(options){\r\n  this.doctype(5);\r\n  this.head(function(){\r\n    this.title(options.title);\r\n    this.stylesheetBlock();\r\n  });\r\n  this.body(function(){\r\n    this.h1(options.title);\r\n    this.contentBlock();\r\n  });\r\n};\r\n\r\nLayout.prototype.stylesheetBlock = function(){};\r\nLayout.prototype.contentBlock = function(){};\r\n```\r\n\r\n```javascript\r\n// myview.js\r\nvar Layout = require('./layout'),\r\n    util = require('util');\r\n\r\nfunction MyExtendedView(){}\r\nmodule.exports = MyExtendedView;\r\nutil.inherits(MyExtendedView, Layout);\r\n\r\nMyView.prototype.contentBlock = function(){\r\n  this.div(function(){\r\n    this.p('My content');\r\n  });\r\n};\r\n```\r\n\r\n```javascript\r\n// extendedview.js\r\nvar MyView = require('./myview'),\r\n    util = require('util');\r\n\r\nfunction ExtendedView(){}\r\nmodule.exports = ExtendedView;\r\nutil.inherits(ExtendedView, MyView);\r\n\r\nExtendedView.prototype.contentBlock = function(){\r\n  ExtendedView.super_.prototype.contentBlock.call(this);\r\n  this.div(function(){\r\n    this.p('Native extensions');\r\n  });\r\n};\r\n```\r\n\r\nExtra Tags\r\n----------\r\n\r\n### The Script Tag\r\n\r\nUsing the `Renderer#script()` function will create a `<script>` tag with the passed function as a string.\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  javascriptBlock: ->\r\n    @script ->\r\n      alert 'Yay! CoffeeScript'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'javascriptBlock'\r\n###\r\n<script>(function () {\r\n          alert('Yay! CoffeeScript!');\r\n        }).call(this)</script>\r\n###\r\n```\r\n\r\n### The Literal Tag\r\n\r\nUsing the `Renderer#lit()` method will just add any content to the output string:\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  contentBlock: ->\r\n    @lit '<wierdtag/> Mung'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'contentBlock'\r\n###\r\n<wierdtag/> Mung\r\n###\r\n\r\n","_id":"coffee-views@2.0.1","dist":{"shasum":"54d2119ad4780ac3d6951e23060e60a2f589704a","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-2.0.1.tgz","integrity":"sha512-T6gQ5VSI6H8xYusg///JFUBhpiduDSGa9wUWNTyH4Yj3vnuu3TAKOUX6sj9gg4fEiUSkeIj3kPHCAU6/lhyhHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEQ1cu0G1HnKMOueRJby2UU5CiTNc0WsemO5xEi1qX2dAiB5kbN30Xx+QKdrCwcJ/y56Fx0/Zw1bsyfgNhYrzPvPXA=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"3.0.0":{"name":"coffee-views","version":"3.0.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view in express.\r\n  render: (options)->\r\n    @doctype 5\r\n    @html ->\r\n\r\n      @head ->\r\n        @title options.title\r\n        @stylesheetBlock()\r\n\r\n      @body ->\r\n        @h1 options.title\r\n        @contentBlock()\r\n\r\n  stylesheetBlock: ->\r\n  \r\n  contentBlock: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n  contentBlock: ->\r\n    @div ->\r\n      @p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View()\r\n\r\nconsole.log view.compile 'render', title: 'My Site'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My Site</title>\r\n  </head>\r\n  <body>\r\n    <h1>My Site</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  contentBlock: ->\r\n    super\r\n    @div ->\r\n      @p 'This is an extension to \"MyView\"'\r\n\r\nview = new MyExtendedView() \r\nconsole.log view.compile 'render', title: 'My extended view'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My extended view</title>\r\n  </head>\r\n  <body>\r\n    <h1>My extended view</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n    <div>\r\n      <p>This is an extension to \"MyView\"</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nPlain ol' JavaScript\r\n--------------------\r\n\r\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\r\n\r\n```javascript\r\n// layout.js\r\nvar Base = require('coffee-views').Base,\r\n    util = require('util');\r\n\r\nfunction Layout(){}\r\nmodule.exports = Layout;\r\nutil.inherits(Layout, Base);\r\n\r\nLayout.prototype.render = function(options){\r\n  this.doctype(5);\r\n  this.head(function(){\r\n    this.title(options.title);\r\n    this.stylesheetBlock();\r\n  });\r\n  this.body(function(){\r\n    this.h1(options.title);\r\n    this.contentBlock();\r\n  });\r\n};\r\n\r\nLayout.prototype.stylesheetBlock = function(){};\r\nLayout.prototype.contentBlock = function(){};\r\n```\r\n\r\n```javascript\r\n// myview.js\r\nvar Layout = require('./layout'),\r\n    util = require('util');\r\n\r\nfunction MyExtendedView(){}\r\nmodule.exports = MyExtendedView;\r\nutil.inherits(MyExtendedView, Layout);\r\n\r\nMyView.prototype.contentBlock = function(){\r\n  this.div(function(){\r\n    this.p('My content');\r\n  });\r\n};\r\n```\r\n\r\n```javascript\r\n// extendedview.js\r\nvar MyView = require('./myview'),\r\n    util = require('util');\r\n\r\nfunction ExtendedView(){}\r\nmodule.exports = ExtendedView;\r\nutil.inherits(ExtendedView, MyView);\r\n\r\nExtendedView.prototype.contentBlock = function(){\r\n  ExtendedView.super_.prototype.contentBlock.call(this);\r\n  this.div(function(){\r\n    this.p('Native extensions');\r\n  });\r\n};\r\n```\r\n\r\nExtra Tags\r\n----------\r\n\r\n### The Script Tag\r\n\r\nUsing the `Renderer#script()` function will create a `<script>` tag with the passed function as a string.\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  javascriptBlock: ->\r\n    @script ->\r\n      alert 'Yay! CoffeeScript'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'javascriptBlock'\r\n###\r\n<script>(function () {\r\n          alert('Yay! CoffeeScript!');\r\n        }).call(this)</script>\r\n###\r\n```\r\n\r\n### The Literal Tag\r\n\r\nUsing the `Renderer#lit()` method will just add any content to the output string:\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  contentBlock: ->\r\n    @lit '<wierdtag/> Mung'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'contentBlock'\r\n###\r\n<wierdtag/> Mung\r\n###\r\n\r\n","_id":"coffee-views@3.0.0","dist":{"shasum":"10e2162280a54072037c0c46a1ad4952ef94b429","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-3.0.0.tgz","integrity":"sha512-OOx0xhpZP0Bln8Y6Ym101RbZzDKR2G3IXhnx6cs1MQXAz+B8FKLrt5d1bEH4CAAIKGa6s1zehxtoUPKHPetsVQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF2NAFVzqGGtNOA0xYE333pP54eMTwdPZXilHNN7ZW1rAiEAlHYLARPat5ajK4+eJ2kdadHRQU1efbZL6r7wm37abz8="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"3.0.1":{"name":"coffee-views","version":"3.0.1","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view in express.\r\n  render: (options)->\r\n    @doctype 5\r\n    @html ->\r\n\r\n      @head ->\r\n        @title options.title\r\n        @stylesheetBlock()\r\n\r\n      @body ->\r\n        @h1 options.title\r\n        @contentBlock()\r\n\r\n  stylesheetBlock: ->\r\n  \r\n  contentBlock: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n  contentBlock: ->\r\n    @div ->\r\n      @p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View()\r\n\r\nconsole.log view.compile 'render', title: 'My Site'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My Site</title>\r\n  </head>\r\n  <body>\r\n    <h1>My Site</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  contentBlock: ->\r\n    super\r\n    @div ->\r\n      @p 'This is an extension to \"MyView\"'\r\n\r\nview = new MyExtendedView() \r\nconsole.log view.compile 'render', title: 'My extended view'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My extended view</title>\r\n  </head>\r\n  <body>\r\n    <h1>My extended view</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n    <div>\r\n      <p>This is an extension to \"MyView\"</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nPlain ol' JavaScript\r\n--------------------\r\n\r\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\r\n\r\n```javascript\r\n// layout.js\r\nvar Base = require('coffee-views').Base,\r\n    util = require('util');\r\n\r\nfunction Layout(){}\r\nmodule.exports = Layout;\r\nutil.inherits(Layout, Base);\r\n\r\nLayout.prototype.render = function(options){\r\n  this.doctype(5);\r\n  this.head(function(){\r\n    this.title(options.title);\r\n    this.stylesheetBlock();\r\n  });\r\n  this.body(function(){\r\n    this.h1(options.title);\r\n    this.contentBlock();\r\n  });\r\n};\r\n\r\nLayout.prototype.stylesheetBlock = function(){};\r\nLayout.prototype.contentBlock = function(){};\r\n```\r\n\r\n```javascript\r\n// myview.js\r\nvar Layout = require('./layout'),\r\n    util = require('util');\r\n\r\nfunction MyExtendedView(){}\r\nmodule.exports = MyExtendedView;\r\nutil.inherits(MyExtendedView, Layout);\r\n\r\nMyView.prototype.contentBlock = function(){\r\n  this.div(function(){\r\n    this.p('My content');\r\n  });\r\n};\r\n```\r\n\r\n```javascript\r\n// extendedview.js\r\nvar MyView = require('./myview'),\r\n    util = require('util');\r\n\r\nfunction ExtendedView(){}\r\nmodule.exports = ExtendedView;\r\nutil.inherits(ExtendedView, MyView);\r\n\r\nExtendedView.prototype.contentBlock = function(){\r\n  ExtendedView.super_.prototype.contentBlock.call(this);\r\n  this.div(function(){\r\n    this.p('Native extensions');\r\n  });\r\n};\r\n```\r\n\r\nExtra Tags\r\n----------\r\n\r\n### The Script Tag\r\n\r\nUsing the `Renderer#script()` function will create a `<script>` tag with the passed function as a string.\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  javascriptBlock: ->\r\n    @script ->\r\n      alert 'Yay! CoffeeScript'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'javascriptBlock'\r\n###\r\n<script>(function () {\r\n          alert('Yay! CoffeeScript!');\r\n        }).call(this)</script>\r\n###\r\n```\r\n\r\n### The Literal Tag\r\n\r\nUsing the `Renderer#lit()` method will just add any content to the output string:\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  contentBlock: ->\r\n    @lit '<wierdtag/> Mung'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'contentBlock'\r\n###\r\n<wierdtag/> Mung\r\n###\r\n\r\n","_id":"coffee-views@3.0.1","dist":{"shasum":"3559505fb614e98d2aa3148f54af45d1c1703424","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-3.0.1.tgz","integrity":"sha512-LWMqNw5qGkrSPcmGf1HfJUF9M1y3FWc2JMCNd7Yf0M7Z/e5PkUNzyFg3cSXiKiwZvrumldRS5EzBSE5PdMpw7Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC/JdqG7huGlTAXd67TW58jMaMwVDxHEjaW/2u8fBMigAiAsR9EuUJpg0MyCdd7nJllLzbVTCoF7Vk0iYLKc/S5AQw=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"4.0.0":{"name":"coffee-views","version":"4.0.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view in express.\r\n  render: (options)->\r\n    @doctype 5\r\n    @html ->\r\n\r\n      @head ->\r\n        @title options.title\r\n        @stylesheetBlock()\r\n\r\n      @body ->\r\n        @h1 options.title\r\n        @contentBlock()\r\n\r\n  stylesheetBlock: ->\r\n  \r\n  contentBlock: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n  contentBlock: ->\r\n    @div ->\r\n      @p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View()\r\n\r\nconsole.log view.compile 'render', title: 'My Site'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My Site</title>\r\n  </head>\r\n  <body>\r\n    <h1>My Site</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  contentBlock: ->\r\n    super\r\n    @div ->\r\n      @p 'This is an extension to \"MyView\"'\r\n\r\nview = new MyExtendedView() \r\nconsole.log view.compile 'render', title: 'My extended view'\r\n###\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title>My extended view</title>\r\n  </head>\r\n  <body>\r\n    <h1>My extended view</h1>\r\n    <div>\r\n      <p>This is my view</p>\r\n    </div>\r\n    <div>\r\n      <p>This is an extension to \"MyView\"</p>\r\n    </div>\r\n  </body>\r\n</html>\r\n###\r\n```\r\n\r\nPlain ol' JavaScript\r\n--------------------\r\n\r\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\r\n\r\n```javascript\r\n// layout.js\r\nvar Base = require('coffee-views').Base,\r\n    util = require('util');\r\n\r\nfunction Layout(){}\r\nmodule.exports = Layout;\r\nutil.inherits(Layout, Base);\r\n\r\nLayout.prototype.render = function(options){\r\n  this.doctype(5);\r\n  this.head(function(){\r\n    this.title(options.title);\r\n    this.stylesheetBlock();\r\n  });\r\n  this.body(function(){\r\n    this.h1(options.title);\r\n    this.contentBlock();\r\n  });\r\n};\r\n\r\nLayout.prototype.stylesheetBlock = function(){};\r\nLayout.prototype.contentBlock = function(){};\r\n```\r\n\r\n```javascript\r\n// myview.js\r\nvar Layout = require('./layout'),\r\n    util = require('util');\r\n\r\nfunction MyExtendedView(){}\r\nmodule.exports = MyExtendedView;\r\nutil.inherits(MyExtendedView, Layout);\r\n\r\nMyView.prototype.contentBlock = function(){\r\n  this.div(function(){\r\n    this.p('My content');\r\n  });\r\n};\r\n```\r\n\r\n```javascript\r\n// extendedview.js\r\nvar MyView = require('./myview'),\r\n    util = require('util');\r\n\r\nfunction ExtendedView(){}\r\nmodule.exports = ExtendedView;\r\nutil.inherits(ExtendedView, MyView);\r\n\r\nExtendedView.prototype.contentBlock = function(){\r\n  ExtendedView.super_.prototype.contentBlock.call(this);\r\n  this.div(function(){\r\n    this.p('Native extensions');\r\n  });\r\n};\r\n```\r\n\r\nExtra Tags\r\n----------\r\n\r\n### The JavaScript Tag\r\n\r\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  javascriptBlock: ->\r\n    @javascript ->\r\n      alert 'Yay! CoffeeScript'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'javascriptBlock'\r\n###\r\n<script>(function () {\r\n          alert('Yay! CoffeeScript!');\r\n        }).call(this)</script>\r\n###\r\n```\r\n\r\n### CSS\r\n\r\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  stylesheetBlock: ->\r\n    @css\r\n      form:\r\n        input:\r\n          padding: '5px'\r\n          border: '1px solid'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'stylesheetBlock'\r\n###\r\n<style>form input {\r\n  padding: 5px;\r\n  border: 1px solid;\r\n}\r\n</style>\r\n###\r\n```\r\n\r\n### The Literal Tag\r\n\r\nUsing the `#lit()` method will just add any content to the output string:\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  contentBlock: ->\r\n    @lit '<wierdtag/> Mung'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'contentBlock'\r\n###\r\n<wierdtag/> Mung\r\n###\r\n```\r\n\r\n### The Unliteral Tag\r\n\r\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\r\n\r\n```coffee\r\nclass MyView extends Base\r\n  contentBlock: ->\r\n    @unlit '<wierdtag/> Mung'\r\n\r\nview = new MyView()\r\nconsole.log view.compile 'contentBlock'\r\n###\r\n&lt;wierdtag/&gt; Mung\r\n###\r\n```\r\n\r\n### Escaping content on the fly\r\n\r\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\r\n\r\n```coffee\r\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\r\n```\r\n\r\n","_id":"coffee-views@4.0.0","dist":{"shasum":"83bd1bd5059968acfbc903c6d7acdbdec45ca3ac","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-4.0.0.tgz","integrity":"sha512-VBLzqUHRFjVKyrC6M3B8Lu/QklFpNeEtGB7zVawe7ydFwsxrA+mIp8M/lGUKQKqjonYgpjY5zK5vUot3CnSs5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhIB/8lmN3cetYpiIZ9fqaay2KGySMwXECT+VhOE9BIgIhAM/2D23+ZYJpX1iTI5//4EGN+16mr7vHFb5GDZDlcNjY"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"4.1.0":{"name":"coffee-views","version":"4.1.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Base} = require 'coffee-views'\n\nmodule.exports = class Layout extends Base\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Base = require('coffee-views').Base,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Base);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Base\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n","_id":"coffee-views@4.1.0","dist":{"shasum":"132506af78f00b3958124590fe4dad0057d0f2eb","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-4.1.0.tgz","integrity":"sha512-Kpx5xk0G596KJ0rcqOh0v+n8zA6qP0rhz3wT4TJ0QiAzQc1JZF0ZbCm9murqo0P3U59KLj97qsckLc1l6gwPaw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCg7u4pSo96ya3eRFLhQgxn+oMvgwoK4uBHBk7/V69YrwIhAPOMjLh9ZXVJ+JKuHYchOfj+XlFORNTSUTJB29pytTDt"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"4.2.0":{"name":"coffee-views","version":"4.2.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Base} = require 'coffee-views'\n\nmodule.exports = class Layout extends Base\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Base = require('coffee-views').Base,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Base);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Base\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n### Comments\n\nHTML comments.\n\n```coffee\n@comment 'Here\\'a a comment'\n@comment ->\n  @p 'I\\'ve been a commented out'\n```\n\n### IE Specific comments\n\n```coffee\n@ie ->\n  @link rel:'stylesheet', href:'ie.css'\n@ie 7, ->\n  @link rel:'stylesheet', href:'ie7.css'\n```\n\n","bugs":{"url":"https://github.com/johngeorgewright/coffee-views/issues"},"_id":"coffee-views@4.2.0","dist":{"shasum":"ad03d705c794b10d9865f78727430db74610b22d","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-4.2.0.tgz","integrity":"sha512-j+UtI5HQ4P2fAVvv+ZWAuv5mL3PSezwQvUip1Viy5FHnvVpZoWysbltlsfr/w5Xb3OCzUl37d0Z0lk/xCuIzuw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA9HPi/dc+zPPtQJPwVY9Osc7OOLxqC8zsaRrBrBv/sMAiAY/q8D5OXbBqqsg7FUCfbRfuP8cC08L87kg+mvFdfPXQ=="}]},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"5.0.0":{"name":"coffee-views","version":"5.0.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Base} = require 'coffee-views'\n\nmodule.exports = class Layout extends Base\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Base = require('coffee-views').Base,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Base);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Base\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Base\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Base\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n### Comments\n\nHTML comments.\n\n```coffee\n@comment 'Here\\'a a comment'\n@comment ->\n  @p 'I\\'ve been a commented out'\n```\n\n### IE Specific comments\n\n```coffee\n@ie ->\n  @link rel:'stylesheet', href:'ie.css'\n@ie 7, ->\n  @link rel:'stylesheet', href:'ie7.css'\n```\n\n","bugs":{"url":"https://github.com/johngeorgewright/coffee-views/issues"},"_id":"coffee-views@5.0.0","dist":{"shasum":"4c27f70d9a9770b4b3cae3288b11760904b71647","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-5.0.0.tgz","integrity":"sha512-y8jmEINQdTwnBy6nk2Kg1C2Oc63hsUkJzkoaIPpFeGGiYqXz2dxfdEsOpYWZNTxocYkRyxElLcbSbUDVfKcVHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGgOwadkoqlG6/UO03i7kcwLkJtZeAY4SuddKrRqndaWAiEAlRx6b411GLOKBjyAm5EcTN9IFjxmRVDckbYpcid/9/I="}]},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"5.1.0":{"name":"coffee-views","version":"5.1.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Html} = require 'coffee-views'\n\nmodule.exports = class Layout extends Html\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Html = require('coffee-views').Html,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Html);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Html\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n### Comments\n\nHTML comments.\n\n```coffee\n@comment 'Here\\'a a comment'\n@comment ->\n  @p 'I\\'ve been a commented out'\n```\n\n### IE Specific comments\n\n```coffee\n@ie ->\n  @link rel:'stylesheet', href:'ie.css'\n@ie 7, ->\n  @link rel:'stylesheet', href:'ie7.css'\n```\n\n","bugs":{"url":"https://github.com/johngeorgewright/coffee-views/issues"},"_id":"coffee-views@5.1.0","dist":{"shasum":"3e357392338b57ca7b6076fc4ae154c460dfdb5f","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-5.1.0.tgz","integrity":"sha512-CNiii45Xa82sXqj7AkopvFBuc2LjdRpaQjlIth7Q7DCqYIu1ylLwtWMU/uOALpToqJMy2IgVPzhRYvhRu6IRog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDD/7UYZ7SFOKNSr2UNHqQQwu3798Br8nYDzkiFj0dcngIhAIvakCv+O9hy9RiJulJNqTkw4plyncIvtAcsYLdeJ1dz"}]},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"5.1.1":{"name":"coffee-views","version":"5.1.1","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Html} = require 'coffee-views'\n\nmodule.exports = class Layout extends Html\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Html = require('coffee-views').Html,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Html);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Html\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n### Comments\n\nHTML comments.\n\n```coffee\n@comment 'Here\\'a a comment'\n@comment ->\n  @p 'I\\'ve been a commented out'\n```\n\n### IE Specific comments\n\n```coffee\n@ie ->\n  @link rel:'stylesheet', href:'ie.css'\n@ie 7, ->\n  @link rel:'stylesheet', href:'ie7.css'\n```\n\n","bugs":{"url":"https://github.com/johngeorgewright/coffee-views/issues"},"_id":"coffee-views@5.1.1","dist":{"shasum":"a7f1f36b79208901abc0edcd511d2e1f35eddf2d","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-5.1.1.tgz","integrity":"sha512-leVwuzlhorhb95+JHXAWg8vp1/Xz6ZWQcybYc0l9OoefV3VqIl/XwAAS9d8XUxjXaeAJhtrUxSJVPSdRTtGFRQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDm3U08HQXjN6q+D/dxne1W/MMO8QRHL2n/gpoFzJ4AnAIgM9J6CXkJhwuWYWPBJasWmLQYqiTsmo/VCdwHsochlw4="}]},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"5.1.2":{"name":"coffee-views","version":"5.1.2","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Html} = require 'coffee-views'\n\nmodule.exports = class Layout extends Html\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Html = require('coffee-views').Html,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Html);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Html\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n### Comments\n\nHTML comments.\n\n```coffee\n@comment 'Here\\'a a comment'\n@comment ->\n  @p 'I\\'ve been a commented out'\n```\n\n### IE Specific comments\n\n```coffee\n@ie ->\n  @link rel:'stylesheet', href:'ie.css'\n@ie 7, ->\n  @link rel:'stylesheet', href:'ie7.css'\n```\n\n","bugs":{"url":"https://github.com/johngeorgewright/coffee-views/issues"},"_id":"coffee-views@5.1.2","dist":{"shasum":"25ad592a383a85c295029c1e41b472161f649377","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-5.1.2.tgz","integrity":"sha512-CO7hyQhufmolvBQGT4WzOFOavY71NbVMn92CnNLKMS/kb0uWUO226EUfV0rKLSZxdYv/oS2fbZg72R7/g9oRBg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIECXmhIryrT+Uu4IwP8pvyhnPi5oiaYj0sRiJJ+ZoWxCAiEAqAQlKA9czPBBhhxnbWLe/67d9EJtvpJBUvGlUucl3xs="}]},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"5.2.0":{"name":"coffee-views","version":"5.2.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Html} = require 'coffee-views'\n\nmodule.exports = class Layout extends Html\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Html = require('coffee-views').Html,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Html);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nExtra Tags\n----------\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Html\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n### Comments\n\nHTML comments.\n\n```coffee\n@comment 'Here\\'a a comment'\n@comment ->\n  @p 'I\\'ve been a commented out'\n```\n\n### IE Specific comments\n\n```coffee\n@ie ->\n  @link rel:'stylesheet', href:'ie.css'\n@ie 7, ->\n  @link rel:'stylesheet', href:'ie7.css'\n```\n\n","bugs":{"url":"https://github.com/johngeorgewright/coffee-views/issues"},"_id":"coffee-views@5.2.0","dist":{"shasum":"cfeb982964fae2b3d074daea5723c63db49e3174","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-5.2.0.tgz","integrity":"sha512-AaSSWuxB5UOX/xQayR3bisB5SI4+9iwmyQK0fPTbP7x1u/zaaJ7RfPXuo0XjkpoS0waV9xjyw9Fy0EO3S3oRkg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCT695KWCC02GSxttwl5FAmvSn4Z5ktZ2H8eV+3G1CPWwIhAJLS/uTN7/6WkDLMdituq9PbUNjc/KYmJB8z/S0bQgR3"}]},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]},"5.3.0":{"name":"coffee-views","version":"5.3.0","description":"An OOP extension to coffee-templates","main":"build/index.js","scripts":{"dev":"coffee -c -b -w -o build src","prepublish":"coffee -c -b -o build src","test":"nodeunit src/test","testbuild":"nodeunit build/test"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"},"keywords":["coffee","coffee-templates","templates","oop templates","express"],"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"license":"BSD","readmeFilename":"README.md","devDependencies":{"coffee-script":"~1.6.2","sinon":"~1.6.0","express":"~3.1.1","nodeunit":"~0.8.0"},"dependencies":{"ccss":"~0.1.2-1"},"readme":"coffee-views\n============\n\nCoffee Views was inspired by [coffee-templates](https://github.com/mikesmullin/coffee-templates) and [coffeekup](https://github.com/gradus/coffeecup) to add template inheritance to CoffeeScript templating.\n\nInstallation\n------------\n\n`npm i --save coffee-views`\n\nExample\n-------\n\n```coffee\n# views/layout.coffee\n\n{Html} = require 'coffee-views'\n\nmodule.exports = class Layout extends Html\n  \n  # The #render() method is automatically called when rendering the view in express.\n  render: (options)->\n    @doctype 5\n    @html {lang:'en'}, ->\n\n      @head ->\n        @title options.title\n        @stylesheetBlock()\n\n      @body ->\n        @h1 options.title\n        @contentBlock()\n\n  stylesheetBlock: ->\n    @link rel:'stylesheet', href:'/css/main.css'\n  \n  contentBlock: ->\n```\n\n```coffee\n# views/myview.coffee\n\nLayout = require './layout'\n\nmodule.exports = class MyView extends Layout\n  contentBlock: ->\n    @div ->\n      @p 'This is my view'\n```\n\n```coffee\nView = require './views/myview'\nview = new View()\nconsole.log view.compile 'render', title: 'My Site'\n```\n\n... will produce ...\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>My Site</title>\n    <link rel=\"stylesheet\" href=\"/css/main.css\"/>\n  </head>\n  <body>\n    <h1>My Site</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n  </body>\n</html>\n```\n\nExample 2 - in Express.js\n-------------------------\n\n```coffee\n# app.coffee\n# using the templates in the previous example\n\n# ...\n\napp = express()\n\napp.configure ->\n  app.engine 'coffee', require('coffee-views').engine\n  app.set 'view engine', 'coffee'\n  app.set 'views', path.join(__dirname, 'views')\n\n# ...\n\napp.get '/', (req, res)->\n  res.render 'myview',\n    title: 'My Site'\n```\n\nInheriting methods\n------------------\n\nJust use CoffeeScript's native `super()` method to return a rendered parent method.\n\n```coffee\nclass MyExtendedView extends MyView\n  contentBlock: ->\n    super\n    @div ->\n      @p 'This is an extension to \"MyView\"'\n\nview = new MyExtendedView() \nconsole.log view.compile 'render', title: 'My extended view'\n###\n<!doctype html>\n<html>\n  <head>\n    <title>My extended view</title>\n  </head>\n  <body>\n    <h1>My extended view</h1>\n    <div>\n      <p>This is my view</p>\n    </div>\n    <div>\n      <p>This is an extension to \"MyView\"</p>\n    </div>\n  </body>\n</html>\n###\n```\n\nPlain ol' JavaScript\n--------------------\n\nThere's a possibility you may want to use plain JavaScript instead of CoffeeScript. In this case, just use Node's **util** module to extend your classes:\n\n```javascript\n// layout.js\nvar Html = require('coffee-views').Html,\n    util = require('util');\n\nfunction Layout(){}\nmodule.exports = Layout;\nutil.inherits(Layout, Html);\n\nLayout.prototype.render = function(options){\n  this.doctype(5);\n  this.head(function(){\n    this.title(options.title);\n    this.stylesheetBlock();\n  });\n  this.body(function(){\n    this.h1(options.title);\n    this.contentBlock();\n  });\n};\n\nLayout.prototype.stylesheetBlock = function(){};\nLayout.prototype.contentBlock = function(){};\n```\n\n```javascript\n// myview.js\nvar Layout = require('./layout'),\n    util = require('util');\n\nfunction MyExtendedView(){}\nmodule.exports = MyExtendedView;\nutil.inherits(MyExtendedView, Layout);\n\nMyView.prototype.contentBlock = function(){\n  this.div(function(){\n    this.p('My content');\n  });\n};\n```\n\n```javascript\n// extendedview.js\nvar MyView = require('./myview'),\n    util = require('util');\n\nfunction ExtendedView(){}\nmodule.exports = ExtendedView;\nutil.inherits(ExtendedView, MyView);\n\nExtendedView.prototype.contentBlock = function(){\n  ExtendedView.super_.prototype.contentBlock.call(this);\n  this.div(function(){\n    this.p('Native extensions');\n  });\n};\n```\n\nRegistering XML Tags\n--------------------\n\nWhen creating your own XML tags you can register them like so:\n\n```coffee\n# my-xml.coffee\n\n{Xml} = require 'coffee-views'\n\nclass MyXml extends Xml\n  \nMyXml.registerTag 'mung'\nMyXml.registerTag 'face'\nMyXml.registerOpenTag 'this-is-always-open'\nMyXml.registerClosedTag 'this-is-always-closed'\n```\n\n```coffee\n# your-xml.coffee\n\nMyXml = require './my-xml'\n\nclass YourXml extends MyXml\n  render: ->\n    @mung ->\n      @face 'yay, custom tags'\n    @['this-is-always-open']()\n    @['this-is-always-closed']()\n\n# <mung><face>yay custom tags</face></mung>\n# <this-is-always-open></this-is-always-open>\n# <this-is-always-closed/>\n```\n\nRegistered HTML Tags\n--------------------\n\nApart from the obvious HTML5 compliant tags, here are a few extras.\n\n### The JavaScript Tag\n\nUsing the `#javascript()` function will create a `<script>` tag with the passed function as a string.\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: ->\n    @javascript ->\n      alert 'Yay! CoffeeScript'\n\nview = new MyView()\nconsole.log view.compile 'javascriptBlock'\n###\n<script>\n(function () {\n  alert('Yay! CoffeeScript!');\n}).call(this)\n</script>\n###\n```\n\nYou can also pass server variables through to your client code:\n\n```coffee\nclass MyView extends Html\n  javascriptBlock: (options)->\n\n    # Assuming \"options\" is {username:'Craig David'}\n\n    @javascript [options.username], (username)->\n      alert \"Your name is #{username}. Lucky you. *snigger*\"\n\n    @javascript [options], (options)->\n      alert \"Name: #{options.name}\"\n\n    @javascript [-> 'Craig David'], (getName)->\n      alert \"getting name... #{getName()}\"\n```\n... will produce ...\n```html\n<script>\n(function(username){\n  alert('Your name is ' + username + '. Lucky you. *snigger*');\n}).call(this, 'Craig David')\n</script>\n\n<script>\n(function(options){\n  alert('Name: ' + options.name);\n}).call(this, {username:'Craig David'});\n</script>\n\n<script>\n(function(getName){\n  alert('getting name... ' + getName());\n}).call(this, function(){ return 'Craig David'; })\n</script>\n```\n\n### CSS\n\nThe `#css()` method renders as [CCSS](https://github.com/aeosynth/ccss). Pass an object and it will create a `<style>` tag.\n\n```coffee\nclass MyView extends Html\n  stylesheetBlock: ->\n    @css\n      form:\n        input:\n          padding: '5px'\n          border: '1px solid'\n\nview = new MyView()\nconsole.log view.compile 'stylesheetBlock'\n###\n<style>form input {\n  padding: 5px;\n  border: 1px solid;\n}\n</style>\n###\n```\n\n### The Literal Tag\n\nUsing the `#lit()` method will just add any content to the output string:\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @lit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n<wierdtag/> Mung\n###\n```\n\n### The Unliteral Tag\n\nUsing the `#unlit()` method will escape content *if* **#safeOutput** is set to **true** (which it is by default).\n\n```coffee\nclass MyView extends Html\n  contentBlock: ->\n    @unlit '<wierdtag/> Mung'\n\nview = new MyView()\nconsole.log view.compile 'contentBlock'\n###\n&lt;wierdtag/&gt; Mung\n###\n```\n\n### Escaping content on the fly\n\nIf you want to make sure something is escaped, go ahead and use the #escape() method:\n\n```coffee\nescapedContent = @escape '<mung>' # => '&lt;mung&gt;'\n```\n\n### Comments\n\nHTML comments.\n\n```coffee\n@comment 'Here\\'a a comment'\n@comment ->\n  @p 'I\\'ve been a commented out'\n```\n\n### IE Specific comments\n\n```coffee\n@ie ->\n  @link rel:'stylesheet', href:'ie.css'\n@ie 7, ->\n  @link rel:'stylesheet', href:'ie7.css'\n```\n\n","bugs":{"url":"https://github.com/johngeorgewright/coffee-views/issues"},"_id":"coffee-views@5.3.0","dist":{"shasum":"7da0f0fcf2c3c48304cfa8ab266f243b885c17af","tarball":"https://registry.npmjs.org/coffee-views/-/coffee-views-5.3.0.tgz","integrity":"sha512-fAYY73PnLbIn/2VsC9+3CveRuAn70oMz1ZKl2rAW8d4ucPaXB1Aqd+sh9Q1i1dm5dS1NHNGPjwWtkgP1puDM7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBEpvx2ZVKXRcm7vwv1gG+7xKNaPpzdEYSm2Vx+ZuzUOAiBXwao19JUvgi+2Y7zZWoGaU6gaRpIDE94TrokiEgaPSQ=="}]},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"},"maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}]}},"readme":"coffee-views\r\n============\r\n\r\nCoffee Views is an extension to [coffee-templates](https://github.com/mikesmullin/coffee-templates) adding template inheritance and an express.js engine.\r\n\r\nInstallation\r\n------------\r\n\r\n`npm i --save coffee-views`\r\n\r\nExample\r\n-------\r\n\r\n```coffee\r\n# views/layout.coffee\r\n\r\n{Base} = require 'coffee-views'\r\n\r\nmodule.exports = class Layout extends Base\r\n  \r\n  # The #render() method is automatically called when rendering the view\r\n  render: ->\r\n    doctype 5\r\n    html ->\r\n\r\n      head ->\r\n        title @title\r\n        @stylesheets()\r\n\r\n      body ->\r\n        h1 @title\r\n        @content()\r\n\r\n  stylesheets: ->\r\n  \r\n  content: ->\r\n```\r\n\r\n```coffee\r\n# views/myview.coffee\r\n\r\nLayout = require './layout'\r\n\r\nmodule.exports = class MyView extends Layout\r\n\r\n  content: ->\r\n    div ->\r\n      p 'This is my view'\r\n```\r\n\r\n```coffee\r\nView = require './views/myview'\r\nview = new View title: 'My Site'\r\n\r\nconsole.log view.render()\r\n```\r\n\r\nExample 2 - in Express.js\r\n-------------------------\r\n\r\n```coffee\r\n# app.coffee\r\n# using the templates in the previous example\r\n\r\n# ...\r\n\r\napp = express()\r\n\r\napp.configure ->\r\n  app.engine 'coffee', require('coffee-views').engine\r\n  app.set 'view engine', 'coffee'\r\n  app.set 'views', path.join(__dirname, 'views')\r\n\r\n# ...\r\n\r\napp.get '/', (req, res)->\r\n  res.render 'myview',\r\n    title: 'My Site'\r\n```\r\n\r\nInheriting methods\r\n------------------\r\n\r\nDue to the nature of coffee-templates, CoffeeScript's native `super()` method cannot be used. Instead, you can use a `parent([methodName])` function:\r\n\r\n```coffee\r\nclass MyExtendedView extends MyView\r\n  content: ->\r\n    literal parent 'content'\r\n    div ->\r\n      p 'This is an extension to \"MyView\"'\r\n```\r\n\r\n","maintainers":[{"name":"johngeorgewright","email":"johngeorge.wright@gmail.com"}],"time":{"modified":"2022-06-13T06:27:59.820Z","created":"2013-04-02T03:41:48.450Z","0.0.1":"2013-04-02T03:41:54.197Z","0.0.3":"2013-04-02T04:42:19.194Z","0.1.0":"2013-04-02T05:28:19.076Z","0.1.1":"2013-04-02T05:54:44.668Z","1.0.0":"2013-04-05T02:04:24.061Z","1.1.0":"2013-04-06T03:11:31.247Z","2.0.0":"2013-04-07T05:40:45.797Z","2.0.1":"2013-04-09T05:45:37.442Z","3.0.0":"2013-04-09T06:26:33.858Z","3.0.1":"2013-04-09T07:34:45.796Z","4.0.0":"2013-04-11T07:12:21.926Z","4.1.0":"2013-04-14T08:54:57.365Z","4.2.0":"2013-06-15T18:24:41.351Z","5.0.0":"2013-06-16T21:17:38.453Z","5.1.0":"2013-06-16T22:34:42.451Z","5.1.1":"2013-06-16T22:39:27.221Z","5.1.2":"2013-06-16T22:48:09.872Z","5.2.0":"2013-06-18T09:01:22.139Z","5.3.0":"2013-12-30T20:46:33.478Z"},"author":{"name":"John Wright","email":"johngeorge.wright@gmail.com"},"repository":{"type":"git","url":"git://github.com/johngeorgewright/coffee-views.git"}}