GithubHelp home page GithubHelp logo

realistic-brunch's Introduction

Realistic Brunch

THIS IS A WORK IN PROGRESS: early alpha, do not expect it to be usable or even working at the moment.

An essential but comprehensive, healthy recipe for your responsive apps.

Javascript + Backbone + Handlebars + Stylus skeleton, boosted with:

Getting started

  • Create a new project via executing brunch new gh:nezoomie/realistic-brunch <project-name> option for the command.
  • Build the project with brunch b or brunch w.
  • Open the public/ dir to see the result.
  • Write your code.

Handy practices included

  • A Config model is provided for storing app-wise data. It merges defaults with the initialization option on startup

  • Models and Collections uses a context field for easily building URIs for nested resources.

      var myCollection = new Collection({
      	urlRoot: 'theCollectionPath'
      });
      
      var myModel = new Model({
      	id: 1234,
      	urlRoot: 'theModelPath' 
      });
      
      myCollection.context = myModel;
      myCollection.fetch();
      
      // `theModelPath/4/theCollectionPath`
    

    Supports nesting:

      var rootModel = new Model({
      	id: 1234,
      	urlRoot: 'rootPath'
      });
    
      var nestedModel = new Model({
      	id: 5678,
      	urlRoot: 'nestedPath'
      });
    
      var myCollection = new Collection({
      	urlRoot: 'theCollectionPath'
      });
      
      var myModel = new Model({
      	id: 9012,
      	urlRoot: 'theModelPath' 
      });
      
      nestedModel.context = rootModel;
      myCollection.context = nestedModel;
      myCollection.add(myModel);
      myModel.fetch();
      
      // `rootPath/1234/nestedPath/5678/theCollectionPath/9012`	
    
  • Marionette.js vent dispatcher for app-wise event bindings

      var app = require('application');
      
      app.vent.trigger('title:change','A different title');  
    
  • Utility function for changing page title via events

  • Handlebars template helpers for integrated translations and date formatting

  • Setup additional HTTP Headers for AJAX requests in the Config directly

  • Custom LOG() function wrapping console.log(), stripped out when building the app with ENV=production

Run tests

Tests are written in Mocha and run using Mocha-PhantomJS.

  • Put your tests into test/
  • Install PhantomJS if missing, npm install -g phantomjs
  • Install Mocha-PhantomJS if missing, npm install -g mocha-phantomjs
  • npm test

Legal Stuff (MIT License)

Distributed under MIT license.

realistic-brunch's People

Watchers

 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.