Code Monkey home page Code Monkey logo

generator-canjs's Introduction

Stories in Ready

generator-canjs

CanJS generator for Yeoman.

Getting started

  • Make sure you have yo installed: npm install -g yo
  • Install the generator: npm install -g generator-canjs
  • Run: yo canjs

Usage

Application scaffold

$ yo canjs

This will create basic application scaffold. It will allow you to choose if you're using RequireJS as a dependency management. This setting will affect the canjs:model and the canjs:control generators.

Model generator

$ yo canjs:model path/to/model

This will create the model file. If you call this generator as yo canjs:model models/user it will create user.js file in the models folder.

Model generator will offer to create fixtures for the generated model. For the User model fixtures will be generated in the fixtures/users.js file.

Control generator

$ yo canjs:control path/to/control/folder

This generator is different than canjs:model as it doesn't create just one file. Instead, it creates a folder which contains all files needed to run this control in isolation.

If you run it like:

$ yo canjs:control controls/users

it will create following structure:

controls/
  users/
    users.js // control file
    users.html // demo page
    init.mustache // example mustache view
    init.ejs // example ejs view

View renderers

This generator installs https://github.com/retro/require-can-renderers which allow loading of mustache and ejs files via RequireJS. It allows you to have code that looks like:

define('mustache!./init', function(initView){
  // initView is a renderer function and can be called as:
  initView()
})

Build

This generator comes with the Gruntfile.js which provides the build task. It will compile JavaScript and view files to the production.js file.

It is a default task so it can be called as:

$ grunt

Or as:

$ grunt build

License

MIT License

generator-canjs's People

Contributors

retro avatar waffle-with-pears avatar

Watchers

 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.