Skip to content

Commit dfcf894

Browse files
dirDisqus: make it publishable
There was a request for a separate repo for the Disqus module so that it can be managed via Bower.
1 parent c6275a6 commit dfcf894

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

Gruntfile.js

+6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ module.exports = function(grunt) {
8585
'src/directives/uiBreadcrumbs/uiBreadcrumbs.tpl.html'],
8686
dest: '../angularUtils-dist/angularUtils-uiBreadcrumbs/'
8787

88+
},
89+
dirDisqus: {
90+
expand: true,
91+
flatten: true,
92+
src: ['src/directives/disqus/dirDisqus.js'],
93+
dest: '../angularUtils-dist/angularUtils-disqus/'
8894
}
8995
}
9096
});

src/directives/disqus/dirDisqus.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,26 @@
77
* Copyright Michael Bromley 2014
88
* Available under the MIT license.
99
*/
10-
angular.module('angularUtils.directives.dirDisqus', [])
1110

12-
.directive('dirDisqus', ['$window', function($window) {
11+
(function() {
12+
13+
/**
14+
* Config
15+
*/
16+
var moduleName = 'angularUtils.directives.dirDisqus';
17+
18+
/**
19+
* Module
20+
*/
21+
var module;
22+
try {
23+
module = angular.module(moduleName);
24+
} catch(err) {
25+
// named module does not exist, so create one
26+
module = angular.module(moduleName, []);
27+
}
28+
29+
module.directive('dirDisqus', ['$window', function($window) {
1330
return {
1431
restrict: 'E',
1532
scope: {
@@ -66,3 +83,5 @@ angular.module('angularUtils.directives.dirDisqus', [])
6683
}
6784
};
6885
}]);
86+
87+
})();

0 commit comments

Comments
 (0)