grunt-bb2ng

Grunt task to convert a Backbone project to an AngularJS project

npm install grunt-bb2ng
8 downloads in the last month

grunt-bb2ng

Grunt task to convert a Backbone project to an AngularJS project

Demo

See this dir for a demo "Hello, World" app generated by grunt-bb2ng. Generated JS is in test.js.

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-bb2ng --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-bb2ng');

The "bb2ng" task

Overview

In your project's Gruntfile, add a section named bb2ng to the data object passed into grunt.initConfig().

grunt.initConfig({
  bb2ng: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})

Options

options.name

Type: String Default value: 'myApp'

A string value representing the name of your brand new AngularJS module.

Usage Examples

Default Options

In this example, we create a new AngularJS app named myApp.

grunt.initConfig({
  bb2ng: {
    options: {},
    files: {
      'dest/my-angularjs-app.js': ['path/to/my-backbone-app.js', 
        'path/to/some-other-file.js'],
    },
  },
})

Custom Options

Here, we can specify the name of our new AngularJS app:

grunt.initConfig({
  bb2ng: {
    options: {
      name: 'omg-angularjs-roolz'
    },
    files: {
      'dest/my-angularjs-app.js': ['path/to/my-backbone-app.js', 
        'path/to/some-other-file.js']
    },
  },
})

Bootstrapping AngularJS

You'll need to include the generated file (above, my-angularjs-app.js) and bootstrap your AngularJS app in some way. The easiest way to do this is to add an ngApp="myApp" (or whatever you named your module) attribte to the <body> or <html> tag of your HTML, as seen (here)[https://github.com/boneskull/grunt-bb2ng/blob/master/demo/test.html].

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 0.1.1 Documentation updates
  • 0.1.0 Initial Release

Also

:satisfied:

npm loves you