Skip to content

Grunt task to convert a Backbone project to an AngularJS project

License

Notifications You must be signed in to change notification settings

boneskull/grunt-bb2ng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

😆

About

Grunt task to convert a Backbone project to an AngularJS project

Resources

License

Stars

Watchers

Forks

Packages

No packages published