0.22.10 • Published 6 years ago

hbjs v0.22.10

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

Hummingbird - a micro JS framework and library

UPDATE 20 Sept 2017: We use this project a lot but here is where we are going with it...

  1. The micro-framework part will be deprecated. Even though it comes in at a small 18k minified, we have resolved to using Vue.js in place of the micro-framework part of Hummingbird. We have found Vue provides a more complete solution and is worth the file size difference for the performance gain and community support. Library stays, but micro framework goes.
  2. We will be taking the utils we have and deprecating some we have found little use for (still to be determined) and then converting them to an ES6 format so they can be easily used in other projects. Many libraries support ES6 now we have some overlap with these other well supported projects.
  3. This project will still exist in its current format and be updated because we do use it with several well maintained projects. It's not going anywhere. The new HB will exist as a library of classes and utils in ES6 under a different branch or repo.

Now back to our regularly scheduled program...

A micro JavaScript framework similar to AngularJS including a plugin library for common functions and utilities.

We built hummingbird using treeshaking. It only compiles the functionality you use.

First, we really like AngularJS. However, there isn't a way to use Angular to build widgets with a small amount of code. Angular's base starts at over 110k minified. Hummingbird is built around the concept of treeshaking (only compiles code that is referenced). Hummingbird can act as either a framework or a library. We are able to achieve this using grunt-treeshake (another open-source project provided by Obogo).

You can build a fully functional widget or application in less than 20k (minified).

Hummingbird's framework supports a simplified version of directives, data binding, templates, scopes and more. It also supports features we wished were in Angular, such as asynchronous loading and better access to utility functions. Hummingbird also provides a directive that allows it's widgets to become first-class citizens in an Angular application.

Hummingbird supports directives, data binding, templates, routes, query selections, http and more.

Documentation

See online documentation

Getting Started

Install Hummingbird via npm

This plugin requires Grunt ~0.4.0

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 hbjs --save-dev

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

grunt.loadNpmTasks('compile');

Create a grunt file and start with the following template.

 module.exports = function (grunt) {
      grunt.initConfig({
           compile: {
                myApp: {
                     options: {
                          scripts: {
                               wrap: "app",
                               src: ["src/*.js"],
                               inspect: ["index.html"],
                               import: [],
                               export: []
                          },
                          templates: {
                               cwd: "src/templates",
                               src: "*.html"
                          },
                          styles: {
                               src: "src/styles/*.less",
                          }
                     },
                     filename: "app",
                     build: "build"
                }
           }
      });

      grunt.loadNpmTasks("hbjs");

      grunt.registerTask("default", "compile");
 };

Grunt options

build

Type: String

Default: undefined

The build directory to output the compile and minified JS file.

options: {
	sample: {
		build: "myFile"
	}
}

filename

Type: String

Default: undefined

Optional. The name of the file to compile the script to. Will produce a filename.js and filename.min.js. By default the "wrap", will be used as the filename.

options: {
	sample: {
		filename: "myFile"
	}
}

Grunt scripts options

exclude

Type: Array of definitions

Default: undefined

Will force ignore definitions and its dependencies from import. You can use either the name of the definition or use a directory with a wildcard. Note: if another file references the same definition, that definition will be imported. If you are excluding a particular definition.

Example of excluding a definition

This will only ignore the "query" definition.

options: {
	sample: {
		scripts: {
			exclude: ["query"]			
		}
	}
}

Example of excluding multiple definitions with a wildcard

This will ignore all query definitions except "query.css".

options: {
	sample: {
		scripts: {
			import: ["query.css"],
			exclude: ["query.*"]			
		}
	}
}

export

Type: Array of definitions

Default: undefined

Exposes only the list of definitions to the api. If no list is provided, all definitions using define() will be added to the public interface.

options: {
	sample: {
		scripts: {
			export: ["query"]		
		}
	}
}

ignore

Type: Array of files or String

Default: undefined

Will exclude importing definitions from files already containing definition. This helps prevent including the same definitions twice.

options: {
	sample: {
		scripts: {
			ignore: ["build/base.js"]	
		}
	}
}

import

Type: Array of definitions or Definition String

Default: undefined

There may be times when you want to include a definition that is not referenced in one of supported formats. This option will allow you to include a file or files if using a wildcard whether referenced in source files or not.

options: {
	sample: {
		scripts: {
			import: ["utils.validators.*", "utils.ajax.http"]
		}
	}
}

inspect

Type: Array of files or String

Default: undefined

Your applications source files to know what to import into the build. Treeshake will inspect your source and look for references that match any definitions in the treeshake library files.

src

Type: Array of files or String

Default: undefined

Additional files to include in treeshake. By default, hummingbird includes the hummingbird framework and utils directories. If you have prepared other files to use treeshake, they may also be included.

wrap

Type: String

Default: Uses the grunt target name

Wraps all of the code in a closure, an easy way to make sure nothing is leaking. For variables that need to be public exports and global variables are made available. The value of wrap is the global variable exports will be available as.

Example

compile: {
        demo: {
            options: {
                 scripts: {
                     wrap: 'myDemo',
                     inspect: ['demo/*.js']
                 }
            },
            files: {
                'demo/treeshaked_lib.js': ['src/**/*.js']
            }
        }
    }

Hummingbird as a framework

Coming soon.

Hummingbird as a library

Coming soon.

Reasons to use Hummingbird

  • No check for scope.$$phase
  • Hummingbird core focuses on Data binding Templates Scope Directives * Everything else is optional
  • Treeshake in only what you use * See grunt-treeshake to see all the benefits of this.
  • Has a large range of utilities
  • Built in REST api structure
  • Mock services for offline and prototyping
  • Easy to integrate unit tests
  • Route support
  • Micro loader < 1k for loading in your external project asynchronously
  • Async module loading
  • Great for building widgets (small file size)
  • Ability to treeshake custom files and libraries
  • Take advantage of the browser's built in functionality to reduce file size and increase speed of digests
  • Easily replace or enhance any part of Hummingbird
  • scope.$ignore (turn on / off watchers)
  • Unique directives * hb-directive-repeat
  • hb intercept matches on each route so you can easily build mocks.
    • you can use regex, url route patterns, and functions to match both pre and post requests for manipulation.
    • You could just use a function and return true to intercept every pre and post.
    • You can also filter by http method. So you can filter on a GET for a url, but ignore a POST for the exact same Url.

Contributing

Hummingbird is maintained by the following developers:

License

Copyright (c) 2014 Obogo. Licensed under the MIT license.

0.22.10

6 years ago

0.22.9

6 years ago

0.22.8

6 years ago

0.22.7

6 years ago

0.22.6

6 years ago

0.22.5

6 years ago

0.22.4

6 years ago

0.22.3

7 years ago

0.22.2

7 years ago

0.22.1

7 years ago

0.22.0

7 years ago

0.21.37

7 years ago

0.21.36

7 years ago

0.21.35

7 years ago

0.21.34

7 years ago

0.21.33

7 years ago

0.21.32

7 years ago

0.21.29

7 years ago

0.21.28

7 years ago

0.21.27

7 years ago

0.21.26

7 years ago

0.21.25

7 years ago

0.21.24

7 years ago

0.21.23

7 years ago

0.21.22

7 years ago

0.21.21

7 years ago

0.21.20

7 years ago

0.21.19

7 years ago

0.21.18

7 years ago

0.21.17

7 years ago

0.21.16

7 years ago

0.21.15

7 years ago

0.21.14

7 years ago

0.21.13

7 years ago

0.21.12

7 years ago

0.21.11

7 years ago

0.21.10

7 years ago

0.21.9

7 years ago

0.21.8

7 years ago

0.21.7

7 years ago

0.21.6

7 years ago

0.21.5

7 years ago

0.21.4

7 years ago

0.21.3

7 years ago

0.21.2

7 years ago

0.21.1

7 years ago

0.21.0

7 years ago

0.20.56

7 years ago

0.20.55

7 years ago

0.20.54

7 years ago

0.20.53

7 years ago

0.20.52

7 years ago

0.20.51

7 years ago

0.20.50

7 years ago

0.20.49

7 years ago

0.20.48

7 years ago

0.20.47

7 years ago

0.20.46

7 years ago

0.20.45

7 years ago

0.20.44

7 years ago

0.20.43

7 years ago

0.20.42

7 years ago

0.20.41

7 years ago

0.20.40

7 years ago

0.20.39

7 years ago

0.20.38

7 years ago

0.20.37

7 years ago

0.20.36

7 years ago

0.20.35

7 years ago

0.20.34

7 years ago

0.20.33

7 years ago

0.20.32

8 years ago

0.20.31

8 years ago

0.20.30

8 years ago

0.20.29

8 years ago

0.20.28

8 years ago

0.20.27

8 years ago

0.20.26

8 years ago

0.20.25

8 years ago

0.20.24

8 years ago

0.20.23

8 years ago

0.20.22

8 years ago

0.20.21

8 years ago

0.20.20

8 years ago

0.20.19

8 years ago

0.20.18

8 years ago

0.20.17

8 years ago

0.20.15

8 years ago

0.20.14

8 years ago

0.20.13

8 years ago

0.20.12

8 years ago

0.20.11

8 years ago

0.20.10

8 years ago

0.20.9

8 years ago

0.20.8

8 years ago

0.20.7

8 years ago

0.20.6

8 years ago

0.20.5

8 years ago

0.20.4

8 years ago

0.20.3

8 years ago

0.20.2

8 years ago

0.20.1

8 years ago

0.20.0

8 years ago

0.19.36

8 years ago

0.19.35

8 years ago

0.19.34

8 years ago

0.19.33

8 years ago

0.19.32

8 years ago

0.19.31

8 years ago

0.19.30

8 years ago

0.19.29

8 years ago

0.19.28

8 years ago

0.19.27

8 years ago

0.19.26

8 years ago

0.19.25

8 years ago

0.19.24

8 years ago

0.19.23

8 years ago

0.19.22

8 years ago

0.19.21

8 years ago

0.19.20

8 years ago

0.19.19

8 years ago

0.19.18

8 years ago

0.19.17

8 years ago

0.19.16

8 years ago

0.19.15

8 years ago

0.19.14

8 years ago

0.19.13

8 years ago

0.19.12

8 years ago

0.19.11

8 years ago

0.19.10

8 years ago

0.19.9

8 years ago

0.19.8

8 years ago

0.19.7

8 years ago

0.19.6

8 years ago

0.19.5

8 years ago

0.19.4

8 years ago

0.19.3

8 years ago

0.19.2

8 years ago

0.19.1

8 years ago

0.19.0

8 years ago

0.18.0

8 years ago

0.17.9

8 years ago

0.17.8

8 years ago

0.17.7

8 years ago

0.17.5

8 years ago

0.17.4

8 years ago

0.17.3

8 years ago

0.17.2

8 years ago

0.17.1

8 years ago

0.17.0

8 years ago

0.16.21

8 years ago

0.16.20

8 years ago

0.16.19

8 years ago

0.16.18

8 years ago

0.16.17

8 years ago

0.16.16

8 years ago

0.16.15

8 years ago

0.16.14

8 years ago

0.16.13

8 years ago

0.16.12

8 years ago

0.16.11

8 years ago

0.16.10

8 years ago

0.16.9

8 years ago

0.16.8

8 years ago

0.16.7

8 years ago

0.16.6

8 years ago

0.16.5

8 years ago

0.16.4

8 years ago

0.16.3

8 years ago

0.16.2

8 years ago

0.16.1

8 years ago

0.16.0

8 years ago

0.15.5

8 years ago

0.15.4

8 years ago

0.15.3

8 years ago

0.15.2

8 years ago

0.15.1

8 years ago

0.15.0

8 years ago

1.0.0

8 years ago

0.14.1

8 years ago

0.14.0

8 years ago

0.13.19

8 years ago

0.13.18

8 years ago

0.13.17

8 years ago

0.13.16

8 years ago

0.13.15

8 years ago

0.13.14

8 years ago

0.13.13

8 years ago

0.13.12

8 years ago

0.13.11

8 years ago

0.13.10

8 years ago

0.13.9

8 years ago

0.13.8

8 years ago

0.13.7

8 years ago

0.13.6

8 years ago

0.13.5

8 years ago

0.13.4

8 years ago

0.13.3

8 years ago

0.13.2

8 years ago

0.13.1

8 years ago

0.13.0

8 years ago

0.12.23

8 years ago

0.12.22

8 years ago

0.12.21

8 years ago

0.12.20

9 years ago

0.12.19

9 years ago

0.12.18

9 years ago

0.12.17

9 years ago

0.12.16

9 years ago

0.12.15

9 years ago

0.12.14

9 years ago

0.12.13

9 years ago

0.12.12

9 years ago

0.12.11

9 years ago

0.12.9

9 years ago

0.12.8

9 years ago

0.12.7

9 years ago

0.12.6

9 years ago

0.12.5

9 years ago

0.12.4

9 years ago

0.12.3

9 years ago

0.12.2

9 years ago

0.12.1

9 years ago

0.12.0

9 years ago

0.11.1

9 years ago

0.11.0

9 years ago

0.10.6

9 years ago

0.10.4

9 years ago

0.10.3

9 years ago

0.10.1

9 years ago

0.10.0

9 years ago

0.9.21

9 years ago

0.9.20

9 years ago

0.9.19

9 years ago

0.9.18

9 years ago

0.9.17

9 years ago

0.9.16

9 years ago

0.9.15

9 years ago

0.9.14

9 years ago

0.9.13

9 years ago

0.9.12

9 years ago

0.9.11

9 years ago

0.9.10

9 years ago

0.9.9

9 years ago

0.9.7

9 years ago

0.9.6

9 years ago

0.9.5

9 years ago

0.9.4

9 years ago

0.9.3

9 years ago

0.9.2

9 years ago

0.9.1

9 years ago

0.9.0

9 years ago

0.8.24

9 years ago

0.8.23

9 years ago

0.8.22

9 years ago

0.8.21

9 years ago

0.8.20

9 years ago

0.8.19

9 years ago

0.8.18

9 years ago

0.8.17

9 years ago

0.8.16

9 years ago

0.8.15

9 years ago

0.8.14

9 years ago

0.8.13

9 years ago

0.8.12

9 years ago

0.8.11

9 years ago

0.8.10

9 years ago

0.8.9

9 years ago

0.8.8

9 years ago

0.8.7

9 years ago

0.8.6

9 years ago

0.8.5

9 years ago

0.8.4

9 years ago

0.8.3

9 years ago

0.8.2

9 years ago

0.8.1

9 years ago

0.8.0

9 years ago

0.7.4

9 years ago

0.7.3

9 years ago

0.7.2

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.18

9 years ago

0.6.17

9 years ago

0.6.16

9 years ago

0.6.15

9 years ago

0.6.14

9 years ago

0.6.13

9 years ago

0.6.12

9 years ago

0.6.11

9 years ago

0.6.10

9 years ago

0.6.9

9 years ago

0.6.8

9 years ago

0.6.7

9 years ago

0.6.6

9 years ago

0.6.5

9 years ago

0.6.4

9 years ago

0.6.3

9 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.50

9 years ago

0.5.49

9 years ago

0.5.48

9 years ago

0.5.47

9 years ago

0.5.46

9 years ago

0.5.45

9 years ago

0.5.44

9 years ago

0.5.43

9 years ago

0.5.42

9 years ago

0.5.41

9 years ago

0.5.40

9 years ago

0.5.39

9 years ago

0.5.38

9 years ago

0.5.37

9 years ago

0.5.36

9 years ago

0.5.35

9 years ago

0.5.34

9 years ago

0.5.33

9 years ago

0.5.32

9 years ago

0.5.31

9 years ago

0.5.30

9 years ago

0.5.29

9 years ago

0.5.28

9 years ago

0.5.27

9 years ago

0.5.26

9 years ago

0.5.25

9 years ago

0.5.24

9 years ago

0.5.23

9 years ago

0.5.22

9 years ago

0.5.21

9 years ago

0.5.20

9 years ago

0.5.19

9 years ago

0.5.18

9 years ago

0.5.17

9 years ago

0.5.16

9 years ago

0.5.15

9 years ago

0.5.14

9 years ago

0.5.13

9 years ago

0.5.12

9 years ago

0.5.11-npm

9 years ago

0.5.10

9 years ago

0.5.9

9 years ago

0.5.8

9 years ago

0.5.7

9 years ago

0.5.6

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.19

9 years ago

0.4.18

9 years ago

0.4.17

9 years ago

0.4.16

9 years ago

0.4.15

9 years ago

0.4.14

9 years ago

0.4.13

9 years ago

0.4.12

9 years ago

0.4.11

9 years ago

0.4.10

9 years ago

0.4.9

9 years ago

0.4.8

9 years ago

0.4.7

9 years ago

0.4.6

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.50

9 years ago

0.3.49

9 years ago

0.3.48

9 years ago

0.3.47

9 years ago

0.3.46

9 years ago

0.3.45

9 years ago

0.3.44

9 years ago

0.3.43

9 years ago

0.3.42

9 years ago

0.3.41

9 years ago

0.3.40

9 years ago

0.3.39

9 years ago

0.3.38

9 years ago

0.3.37

9 years ago

0.3.36

9 years ago

0.3.35

9 years ago

0.3.34

9 years ago

0.3.33

9 years ago

0.3.32

9 years ago

0.3.31

9 years ago

0.3.30

9 years ago

0.3.29

9 years ago

0.3.28

9 years ago

0.3.27

9 years ago

0.3.26

9 years ago

0.3.25

9 years ago

0.3.24

9 years ago

0.3.23

9 years ago

0.3.22

9 years ago

0.3.21

9 years ago

0.3.20

9 years ago

0.3.19

9 years ago

0.3.18

9 years ago

0.3.17

9 years ago

0.3.16

9 years ago

0.3.15

9 years ago

0.3.14

9 years ago

0.3.13

9 years ago

0.3.12

9 years ago

0.3.11

9 years ago

0.3.10

9 years ago

0.3.9

9 years ago

0.3.8

9 years ago