Skip to content

Commit 787bacd

Browse files
committed
Merge branch 'feature/umd-pattern'
2 parents 3a47afd + 3b7fe00 commit 787bacd

11 files changed

Lines changed: 39430 additions & 358 deletions

Gruntfile.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ module.exports = function(grunt) {
2121
concat: {
2222
options: {
2323
banner: '<%= meta.banner %>\n\n'+
24-
'/* commonjs package manager support (eg componentjs) */\n'+
25-
'if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){\n'+
26-
' module.exports = \'<%= modulename %>\';\n'+
27-
'}\n\n'+
28-
'(function (window, angular, undefined) {\n',
29-
footer: '})(window, window.angular);'
24+
'(function (root, factory) {\n'+
25+
' if (typeof define === "function" && define.amd) {\n'+
26+
' define(["angular", "hljs"], factory);\n'+
27+
' } else if (typeof module === "object" && module.exports) {\n'+
28+
' module.exports = factory(require("angular"), require("highlight.js"));\n'+
29+
' } else {\n'+
30+
' root.returnExports = factory(root.angular, root.hljs);\n'+
31+
' }\n'+
32+
'}(this, function (angular, hljs) {\n\n',
33+
footer: '\n\n'+
34+
' return "<%= modulename %>";\n'+
35+
'}));'
3036
},
3137
build: {
3238
src: '<%= dir.src %>/<%= pkg.name %>.js',

angular-highlightjs.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
/*! angular-highlightjs
2-
version: 0.4.1
3-
build date: 2015-02-03
4-
author: Chih-Hsuan Fan
5-
https://github.com/pc035860/angular-highlightjs.git */
6-
7-
/* commonjs package manager support (eg componentjs) */
8-
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
9-
module.exports = 'hljs';
10-
}
11-
12-
(function (window, angular, undefined) {
13-
/*global angular*/
1+
/*! angular-highlightjs
2+
version: 0.4.1
3+
build date: 2015-07-25
4+
author: Chih-Hsuan Fan
5+
https://github.com/pc035860/angular-highlightjs.git */
6+
7+
(function (root, factory) {
8+
if (typeof define === "function" && define.amd) {
9+
define(["angular", "hljs"], factory);
10+
} else if (typeof module === "object" && module.exports) {
11+
module.exports = factory(require("angular"), require("highlight.js"));
12+
} else {
13+
root.returnExports = factory(root.angular, root.hljs);
14+
}
15+
}(this, function (angular, hljs) {
16+
17+
/*global angular, hljs*/
1418

1519
function shouldHighlightStatics(attrs) {
1620
var should = true;
@@ -24,7 +28,6 @@ function shouldHighlightStatics(attrs) {
2428
return should;
2529
}
2630

27-
2831
var ngModule = angular.module('hljs', []);
2932

3033
/**
@@ -40,10 +43,9 @@ ngModule.provider('hljsService', function () {
4043
getOptions: function () {
4144
return angular.copy(_hljsOptions);
4245
},
43-
$get: ['$window', function ($window) {
44-
($window.hljs.configure || angular.noop)(_hljsOptions);
45-
return $window.hljs;
46-
}]
46+
$get: function () {
47+
return hljs;
48+
}
4749
};
4850
});
4951

@@ -376,5 +378,7 @@ ngModule
376378
.directive('hljs', hljsDir)
377379
.directive('language', languageDirFactory('language'))
378380
.directive('source', sourceDirFactory('source'))
379-
.directive('include', includeDirFactory('include'));
380-
})(window, window.angular);
381+
.directive('include', includeDirFactory('include'));
382+
383+
return "hljs";
384+
}));

angular-highlightjs.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/angular-highlightjs.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
/*! angular-highlightjs
2-
version: 0.4.1
3-
build date: 2015-02-03
4-
author: Chih-Hsuan Fan
5-
https://github.com/pc035860/angular-highlightjs.git */
6-
7-
/* commonjs package manager support (eg componentjs) */
8-
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
9-
module.exports = 'hljs';
10-
}
11-
12-
(function (window, angular, undefined) {
13-
/*global angular*/
1+
/*! angular-highlightjs
2+
version: 0.4.1
3+
build date: 2015-07-25
4+
author: Chih-Hsuan Fan
5+
https://github.com/pc035860/angular-highlightjs.git */
6+
7+
(function (root, factory) {
8+
if (typeof define === "function" && define.amd) {
9+
define(["angular", "hljs"], factory);
10+
} else if (typeof module === "object" && module.exports) {
11+
module.exports = factory(require("angular"), require("highlight.js"));
12+
} else {
13+
root.returnExports = factory(root.angular, root.hljs);
14+
}
15+
}(this, function (angular, hljs) {
16+
17+
/*global angular, hljs*/
1418

1519
function shouldHighlightStatics(attrs) {
1620
var should = true;
@@ -24,7 +28,6 @@ function shouldHighlightStatics(attrs) {
2428
return should;
2529
}
2630

27-
2831
var ngModule = angular.module('hljs', []);
2932

3033
/**
@@ -40,10 +43,9 @@ ngModule.provider('hljsService', function () {
4043
getOptions: function () {
4144
return angular.copy(_hljsOptions);
4245
},
43-
$get: ['$window', function ($window) {
44-
($window.hljs.configure || angular.noop)(_hljsOptions);
45-
return $window.hljs;
46-
}]
46+
$get: function () {
47+
return hljs;
48+
}
4749
};
4850
});
4951

@@ -376,5 +378,7 @@ ngModule
376378
.directive('hljs', hljsDir)
377379
.directive('language', languageDirFactory('language'))
378380
.directive('source', sourceDirFactory('source'))
379-
.directive('include', includeDirFactory('include'));
380-
})(window, window.angular);
381+
.directive('include', includeDirFactory('include'));
382+
383+
return "hljs";
384+
}));

build/angular-highlightjs.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
"readmeFilename": "README.md",
2525
"devDependencies": {
2626
"grunt": "~0.4.1",
27-
"grunt-contrib-uglify": "~0.7.0",
28-
"grunt-contrib-jshint": "~0.11.0",
29-
"grunt-contrib-watch": "~0.6.0",
30-
"grunt-contrib-connect": "~0.9.0",
27+
"grunt-contrib-uglify": "^0.7.0",
28+
"grunt-contrib-jshint": "^0.11.0",
29+
"grunt-contrib-watch": "^0.6.0",
30+
"grunt-contrib-connect": "^0.9.0",
3131
"grunt-contrib-concat": "^0.5.0",
3232
"grunt-contrib-copy": "^0.7.0"
33-
}
33+
},
34+
"dependencies": {}
3435
}

src/angular-highlightjs.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global angular*/
1+
/*global angular, hljs*/
22

33
function shouldHighlightStatics(attrs) {
44
var should = true;
@@ -12,7 +12,6 @@ function shouldHighlightStatics(attrs) {
1212
return should;
1313
}
1414

15-
1615
var ngModule = angular.module('hljs', []);
1716

1817
/**
@@ -28,10 +27,9 @@ ngModule.provider('hljsService', function () {
2827
getOptions: function () {
2928
return angular.copy(_hljsOptions);
3029
},
31-
$get: ['$window', function ($window) {
32-
($window.hljs.configure || angular.noop)(_hljsOptions);
33-
return $window.hljs;
34-
}]
30+
$get: function () {
31+
return hljs;
32+
}
3533
};
3634
});
3735

@@ -364,4 +362,4 @@ ngModule
364362
.directive('hljs', hljsDir)
365363
.directive('language', languageDirFactory('language'))
366364
.directive('source', sourceDirFactory('source'))
367-
.directive('include', includeDirFactory('include'));
365+
.directive('include', includeDirFactory('include'));

with-browserify/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/tomorrow.min.css">
99
<link rel="stylesheet" href="style.css" />
1010

11-
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
12-
1311
<script src="scripts/bundle.js"></script>
1412
</head>
1513

with-browserify/package.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@
1111
"license": "ISC",
1212
"devDependencies": {
1313
"angular": "^1.3.11",
14-
"angular-highlightjs": "^0.4.0",
15-
"browserify-shim": "^3.8.2"
14+
"highlight.js": "^8.6.0"
1615
},
17-
1816
"browserify": {
19-
"transform": [ "browserify-shim" ]
20-
},
21-
"browser": {
22-
"angular": "./node_modules/angular/angular.min.js"
23-
},
24-
"browserify-shim": {
25-
"angular": "angular"
17+
"transform": []
2618
}
2719
}

0 commit comments

Comments
 (0)