Giter Site home page Giter Site logo

thebennos / rendercat Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 400 KB

The rendercat rendering engine

Home Page: http://rendercat-snapshot-1.neilellis.cont.tutum.io/

License: Apache License 2.0

JavaScript 46.84% TypeScript 16.73% Shell 28.45% Nginx 3.05% HTML 2.88% CSS 2.04%

rendercat's Introduction

A DIY rendering engine for all your rendering needs based on NodeJS, Express, PhantomJS and SlimerJS amongst other tools.

For a fully functioning example please visit the project http://github.com/neilellis/rendercat-example or http://github.com/neilellis/rendercat-snapshot or use the demos online at http://rendercat-example-1.neilellis.cont.tutum.io/ or http://rendercat-snapshot-1.neilellis.cont.tutum.io/

To use rendercat create a new project with a Dockerfile like this:

FROM neilellis/rendercat

Make sure you have directories called public and modules these will be added automatically (you don't need to put instructions in your Dockerfile). The public directory contains static artifacts that will be served up by rendercat's Nginx instance. The modules directory should contain CommonJS style modules (see http://github.com/neilellis/rendercat-snapshot for an example of layout).

Rendercat makes available the functions in the modules using the following URL format

  /api/<api-version>/<module>/<function>

The current api version is 0.1.

The function should take only a single argument, the rc (Rendercat) object which also supplies a function for rendering URLs:

function render(rc) {
  var req= rc.req;
  var res= rc.res;
  
  ...
  
  rc.renderUsing(url, delay, lang, width, height, viewportWidth, viewportHeight, imageType, deviceType, function (result) {
                            //If result starts with 'FAIL' then rendering failed otherwise it is the
                            //rendered file location.
                           rc.res.redirect(result.replace("/app/public/", "/"));
                           rc.res.end();
                       });
}

and a function for running JavaScript within PhantomJS

 rc.inBrowser(function (ph) {
        ph.createPage(function (page) {
            page.open(address, function (status) {
              ...
            });
        });
  });

To understand how to use ph.createPage please read the documentation for the phantomjs-node project.

The recommended manner for adding NodeJS modules is by adding npm install x.y.z instructions in the Dockerfile.

Dependency Status

Released under ASL 2.0 (c) 2014-2015 Neil Ellis

rendercat's People

Contributors

neilellis avatar

Watchers

Benjamin avatar James Cloos avatar

Forkers

bytearchive

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.