Giter VIP home page Giter VIP logo

mildred's Introduction

Mildred - Application Architecture for Backbone.js

Mildred is a backbone.js application architecture forked from ChaplinJS. the main goal of Mildred is to be a simpler to use Chaplin.js, with no AMD required and some fancy features left out.

Build Status

Changes from ChaplinJS

non-amd

Mildred most important feature is that it's written as non-amd ready library, it lives in the namespace under Mildred.XXX.

Controllers And Dispatcher

Since Mildred is non-amd fork, The dispatcher logic and the Controllers workflow changed a lot. In ChaplinJS the Dispatcher loads the controller using the AMD module provided, so the controllers are restricted to be at a specific directory with specific names. Mildred handle this differently, your Controllers may live wherever you want them to be as long as you give them to Mildred as an Array or an Object.

In the Application intialization you should give the app an option called 'controllers' with your controllers, either as an object or as an array. e.g:

class MyApp extends Mildred.Application
  title: "example"

# The initialization
new MyApp
  routes: routes_var
  controllers: [MainController, AnotherController, name_controller, also_Controller, justname]

as you can see, Mildred accepts all sort of naming conventions: "nameController", "name_controller", "name_Controller" etc' or just a name without "controller" in it. that's it so you can use the name on your routes without the ending "controller", as you can in Chaplin.

The object paradigm is useful when you would like to keep your app logic under some namespace and all your controllers are under some Object already. e.g:

class MyApp.Controllers.Main extends Mildred.Controller
  # logic here

class MyApp.Controllers.AnotherController extends Mildred.Controller
  # logic here

# The initialization
new MyApp
  routes: routes_var
  controllers: MyApp.Controllers

some more differences to be well documented:

  • Access to components is made by Mildred.Component, e.g: Mildred.Model, Mildred.Controller, Mildred.Layout etc'
  • Mediator and event_broker are completely gone. use Backbone.js events instead, they are great and in my opinion the Mediator wrapper for them was redundant and causing confusion.
  • No regions at all.
  • Views - the noWrap functionality is gone.
  • Views - TemplateFunc is default to _.template unless specifically changed
  • Templating - by default we assume using the underscore built in template render. you may give the application an application wide templating function, in the options to the Application object under the name "templateFunction", and as always, you can override it in the view by overriding the getTemplateFunction as it is in Chaplin.

This sums it up for now, I hope to get a full documentation soon, but if you come from Chaplin experience you can get it work, or you can just follow Chaplin's documentation with this changes in mind.

Build, Test, Contribute

  1. sudo npm install -g grunt-cli
  2. cd mildred && npm install && npm build
  3. npm test or open test/index.html
  4. grunt watch

mildred's People

Contributors

afroald avatar aheuermann avatar akre54 avatar andriijas avatar cbourgois avatar chadhietala avatar cpsubrian avatar davidnpma avatar denikus avatar fb3 avatar flisky avatar iangreenleaf avatar karellm avatar knuton avatar lukateake avatar mehcode avatar miklschmidt avatar mkuprionis avatar molily avatar opyh avatar paulmillr avatar plorent avatar pulse00 avatar radagaisus avatar rendez avatar rubiii avatar snird avatar vendethiel avatar wprater avatar yandrew91 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

bnayazil

mildred's Issues

Rewrite dispatcher tests

The Mildred dispacher has been completely rewritten to support loading controllers by naming conventions (xxxController, xxx_controller etc'..) and by passing controllers object\array to the initialize function.
The tests should have a complete rewrite as well to support this changes.

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.