Giter Site home page Giter Site logo

durandal-jade's Introduction

Jade-Durandal proof of concept

What it is

A simple Jade view engine for the Durandal framework. It renders jade source into html, which is in turn passed to the regular Durandal view locator.

What it's not

Since it just provides an extra layer on top of the regular view engine, viewmodel template variables are not available in the jade template scope for rendering, however, you can use good old data-bind just like you would in regular html templates.

ul(data-bind="foreach: listOfStuff")
  li
    span(data-bind="text: $data")

How it works

  1. Add jade to Requirejs' path config.
  2. Tell Requirejs to load jadeViewEngine instead of the default viewEngine
  3. Write Jade, be happy.
requirejs.config({
    paths: {
        'text': '../lib/require/text',
        'durandal':'../lib/durandal/js',
        'plugins' : '../lib/durandal/js/plugins',
        'transitions' : '../lib/durandal/js/transitions',
        'knockout': '../lib/knockout/knockout-2.3.0',
        'bootstrap': '../lib/bootstrap/js/bootstrap',
        'jquery': '../lib/jquery/jquery-1.9.1',
        'jade': ['https://rawgithub.com/visionmedia/jade/0.35.0', '../lib/jade'],
        'durandal/viewEngine': '../lib/durandal/js/jadeViewEngine'
    },
    shim: {
        'bootstrap': {
            deps: ['jquery'],
            exports: 'jQuery'
       }
    }
});

Demo

Take a look here, put it on a web server of your own or run one quickly by using a simple web server

durandal-jade's People

Contributors

jpwesselink avatar

Watchers

 avatar  avatar  avatar

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.