Skip to content

Commit

Permalink
Merge pull request #244 from nickjanssen/master
Browse files Browse the repository at this point in the history
feat(plugin): support for ng-annotate, process .ng.js files
  • Loading branch information
Urigo committed Mar 20, 2015
2 parents b33693a + 29d4cf8 commit a4a3455
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 0 deletions.
1 change: 1 addition & 0 deletions .npm/plugin/ngAnnotate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions .npm/plugin/ngAnnotate/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This directory and the files immediately inside it are automatically generated
when you change this package's NPM dependencies. Commit the files in this
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control
so that others run the same versions of sub-dependencies.

You should NOT check in the node_modules directory that Meteor automatically
creates; if you are using git, the .gitignore file tells git to ignore it.
63 changes: 63 additions & 0 deletions .npm/plugin/ngAnnotate/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ Package.registerBuildPlugin({
}
});

Package.registerBuildPlugin({
name: 'ngAnnotate',
sources: [
'plugin/annotate.js'
],
npmDependencies: {
'ng-annotate': '0.15.4'
}
});

Package.on_use(function (api) {
api.versionsFrom('[email protected]');

Expand Down
18 changes: 18 additions & 0 deletions plugin/annotate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

var ngAnnotate = Npm.require('ng-annotate');

Plugin.registerSourceHandler('ng.js', {
isTemplate: true,
archMatching: 'web'
}, function(compileStep) {

var ret = ngAnnotate(compileStep.read().toString('utf8'), {
add: true
});

compileStep.addJavaScript({
path : compileStep.inputPath,
data : ret.src,
sourcePath : compileStep.inputPath
});
});

0 comments on commit a4a3455

Please sign in to comment.