Skip to content

Commit 4974c95

Browse files
committed
apply ngAnnotate plugin to the build flow
1 parent c9bb981 commit 4974c95

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

Gruntfile.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module.exports = function (grunt)
6363
return url.replace('src/', '');
6464
},
6565
bootstrap: function (module, script) {
66-
return 'module.run([\'$templateCache\', function($templateCache) {\n' + script + '\n}]);';
66+
return 'module.run(function($templateCache) {\n' + script + '\n});';
6767
}
6868
}
6969
}
@@ -83,17 +83,33 @@ module.exports = function (grunt)
8383
{expand: true, flatten: true, src: ['src/rzslider.js'], dest: 'dist/'}
8484
]
8585
}
86+
},
87+
88+
ngAnnotate: {
89+
options: {
90+
singleQuotes: true,
91+
},
92+
rzslider: {
93+
files: [{
94+
'dist/rzslider.js': 'dist/rzslider.js'
95+
}, {
96+
expand: true,
97+
src: ['dist/rzslider.js']
98+
}
99+
]
100+
}
86101
}
87-
102+
88103
});
89104

90105
grunt.loadNpmTasks('grunt-contrib-uglify');
91106
grunt.loadNpmTasks('grunt-recess');
92107
grunt.loadNpmTasks('grunt-angular-templates');
93108
grunt.loadNpmTasks('grunt-replace');
109+
grunt.loadNpmTasks('grunt-ng-annotate');
94110

95111
grunt.registerTask('default', ['css', 'js']);
96112

97113
grunt.registerTask('css', ['recess']);
98-
grunt.registerTask('js', ['ngtemplates','replace', 'uglify']);
114+
grunt.registerTask('js', ['ngtemplates','replace', 'ngAnnotate', 'uglify']);
99115
};

dist/rzslider.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ function throttle(func, wait, options) {
12461246
return Slider;
12471247
}])
12481248

1249-
.directive('rzslider', ['RzSlider', function(Slider)
1249+
.directive('rzslider', ['RzSlider', function(RzSlider)
12501250
{
12511251
'use strict';
12521252

@@ -1283,7 +1283,7 @@ function throttle(func, wait, options) {
12831283

12841284
link: function(scope, elem, attr)
12851285
{
1286-
return new Slider(scope, elem, attr);
1286+
return new RzSlider(scope, elem, attr);
12871287
}
12881288
};
12891289
}]);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"grunt-angular-templates": "^0.5.7",
1717
"grunt-contrib-mincss": "~0.3.2",
1818
"grunt-contrib-uglify": "~0.2.2",
19+
"grunt-ng-annotate": "^1.0.1",
1920
"grunt-recess": "~0.4.0",
2021
"grunt-replace": "^0.11.0",
2122
"recess": "~1.1.9"

src/rzslider.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function throttle(func, wait, options) {
7676
};
7777
})
7878

79-
.factory('RzSlider', ['$timeout', '$document', '$window', 'throttle', function($timeout, $document, $window, throttle)
79+
.factory('RzSlider', function($timeout, $document, $window, throttle)
8080
{
8181
'use strict';
8282

@@ -1244,9 +1244,9 @@ function throttle(func, wait, options) {
12441244
};
12451245

12461246
return Slider;
1247-
}])
1247+
})
12481248

1249-
.directive('rzslider', ['RzSlider', function(Slider)
1249+
.directive('rzslider', function(RzSlider)
12501250
{
12511251
'use strict';
12521252

@@ -1283,10 +1283,10 @@ function throttle(func, wait, options) {
12831283

12841284
link: function(scope, elem, attr)
12851285
{
1286-
return new Slider(scope, elem, attr);
1286+
return new RzSlider(scope, elem, attr);
12871287
}
12881288
};
1289-
}]);
1289+
});
12901290

12911291
// IDE assist
12921292

0 commit comments

Comments
 (0)