coffeemate

0.5.1 • Public • Published

Coffeemate!

   )
   (
 C[_] coffeemate, the coffee creamer!

coffeemate is a web framework built on top of connect and specialized for writing web apps comfortably in coffeescript. It uses eco template engine by default for fullfill coffeescript experience. But also using coffeekup or any other template engine is only a matter of few seconds.

coffeemate's magic is hidden inside that, it is perfectly a singleton instance of connect framework's HTTPServer implementation. So hacking coffeemate is pretty easy and funny :)

What is it look like?

# app.coffee 
 
# Require it 
mate = require 'coffeemate'
 
# Connect it 
mate.logger()
mate.static("#{__dirname}/public")
 
# Extend it 
mate.context.highlight = (color, txt) ->
  "<span style=\"background-color:#{color}\">#{txt}</span>"
 
# Route it 
mate.get '/greet/:name'->
    # this is context variable 
    @greet_msg = "Hello, #{@req.params.name}"
    @render 'main'
 
# Remote it 
mate.now.greet = ->
    console.log 'Hello, World!'
 
# Listen it 
mate.listen 3000
<!-- layout.eco -->
<html>
  <head>
    <script src="/nowjs/now.js"></script> 
    <script type="text/javascript">
      now.ready(function () {
        now.greet();
      });
    </script> 
  </head>
  <body>
      <%- @include @body %>
  </body>
</html>
<!-- main.eco -->
 
<h1>Welcome to Coffeemate</h1>
<div><%- @highlight '#f00', @greet_msg %></div>
<div><%- @include 'nested' %></div>
<!-- nested.eco -->
 
<h2>I'm a partial template</h2>
<div><%- @highlight '#ff0', @greet_msg %></div>

Hmmm, What to expect more?

Install

$ npm install coffeemate

Documentation

Annotated source documentation generated by docco can be found here http://kadirpekel.github.com/coffeemate

Demos & Examples

See plenty of examples

https://github.com/kadirpekel/coffeemate/tree/master/examples

Licence

Copyright (c) 2011 Kadir Pekel.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Dependents (0)

Package Sidebar

Install

npm i coffeemate

Weekly Downloads

4

Version

0.5.1

License

none

Last publish

Collaborators

  • coffeemate