Skip to content

hgwood/inject-this-brunch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inject this brunch!

A ng-annotate plugin for brunch.

DEPRECATED: ng-annotate, which this project depends on, is now deprecated. You are advised to use babel-plugin-angularjs-annotate instead.

Why not the other existing things?

Two ng-annotate plugins for brunch already exist: ng-annotate-brunch and ng-annotate-uglify-js-brunch.

Initial reason (turns out to be invalid)

The two existing solutions did not fit my use case because they place the annotating process inside the optimize phase of brunch. This means that annotations were not present in the development build, only in the production build. I want the annotations to be there in dev so I can have ng-strict-di enabled and that will check if the annotations are really all there.

Turns out you can use the plugins.on option in the brunch config to force optimize plugins to run.

Actual reasons

  • You might not need or want to minify at the same stage as annotating so ng-annotate-uglify-js-brunch is out.
  • ng-annotate-brunch does not have source maps support.
  • ng-annotate-brunch does not support an ignore option, which can give a significant speed boost.

Usage

npm install inject-this-brunch

Configuration

plugins: {
  ngAnnotate: {
    // place config here
  }
}

For ng-annotate

The plugin configuration is passed to ng-annotate. By default, the following options are passed: {add: true, remove: true, map: {inFile: <path of input file>}}, i.e. annotations are rebuilt and source maps are generated.

When a configuration is provided in brunch-config.js:

  • add and remove default to true unless they are explicitly set to falsy values.
  • map.inFile is automatically provided unless map is explicitly set to a falsy value.

pattern

Default: /\.js$/

ignore

Default: /^(bower_components|vendor)/