npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-bbr

v0.1.5

Published

Yeoman generator for RequireJS based Backbone apps.

Downloads

2

Readme

Backbone.js/RequireJS generator Build Status

Maintainer: Matt Przybylski

A Backbone generator that uses RequireJS for Yeoman that provides a functional boilerplate Backbone app out of the box. You also get access to a number of sub-generators which can be used to easily create individual models, views, collections and so on.

This is technically a fork of the official Yeoman Backbone.js generator that has been heavily edited to suit my needs and coding style. I've added Jade templating and removed anything that I don't use or that I viewed as unnecessary.

Usage

Install: npm install -g generator-bbr

Make a new directory and cd into it:

mkdir my-new-project && cd $_

Run yo bbr, optionally passing an app name:

yo bbr [app-name]

Generators

Available generators:

  • bbr:model
  • bbr:view
  • bbr:collection
  • bbr:router
  • bbr:all

Typical workflow

yo bbr # generates your application base and build workflow
yo bbr:model blog
yo bbr:collection blog
yo bbr:router blog
yo bbr:view blog
grunt server

You could also optionally pass a second parameter to the subgenerator that will define the directory structure to put the files into:

yo bbr:model modelname directory/to/put/it
yo bbr:collection collectionname directory/to/put/it
yo bbr:router routername directory/to/put/it
yo bbr:view viewname directory/to/put/it

Collection subgenerators also take a third parameter (optional) that allows you to define the path to your model:

yo bbr:collection collectionname directory/to/put/it path/to/model

So, in the case that you have the following structure:

|-- js
|   |-- models
|       |-- test
|           |-- test.js

And you want to create a collection for TestModel (the name of the model from test.js), you would run this:

yo bbr:collection test test test # first is name of collection, second is directory to create it in, third is path to model

This would generate the following:

|-- js
|   |-- collections
|       |-- test
|           |-- test.js # TestCollection
|   |-- models
|       |-- test
|           |-- test.js # TestModel

Now TestCollection references TestModel with the define statement looking for models/test/test and passing it in as TestModel for reference within the collection.

NOTE: Do not put beginning or trailing slashes on the directory structure!

Options

  • --skip-install

    Skips the automatic execution of bower and npm after scaffolding has finished.

  • --test-framework=[framework]

    Defaults to mocha. Can be switched for another supported testing framework like jasmine.

A note regarding JST templates and strict mode

If you use strict mode in your app and JST templates the default grunt-jst implementation will cause your app to error out as the templates will be precompiled using a 'with' statement.

This can be addressed by changing the jst grunt task as follows:

jst: {
    compile: {
        options:
        {
            templateSettings:
            {
                variable: 'data'
            }
        },
        files: {
            '.tmp/scripts/templates.js': ['<%= yeoman.app %>/scripts/templates/*.ejs']
        }
    }
},

A result of this change is that your template variable definitions must also be updated from <%= templateVariable %> to <%= data.templateVariable %>. More information on this can be found in the Underscore documentation.

License

MIT license