Skip to content

Commit

Permalink
Merge pull request #58 from terraflubb/usestrict_option
Browse files Browse the repository at this point in the history
Add usestrict option to include `'use strict';` in output
  • Loading branch information
ericclemmons committed Dec 1, 2013
2 parents 9540360 + 623b596 commit 147a9ad
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ Defaults to `false`.
Normally, this isn't needed as specifying your files with `cwd`
ensures that URLs load via both AJAX and `$templateCache`.


## Usage


Expand Down
6 changes: 5 additions & 1 deletion tasks/lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ var Compiler = function(grunt, options, cwd) {
return true;
});

var script = paths
var script = ' \'use strict\';' + grunt.util.linefeed;

script += paths
.map(this.load)
.map(this.minify)
.map(function(source, i) {
Expand All @@ -80,6 +82,8 @@ var Compiler = function(grunt, options, cwd) {
.join(grunt.util.linefeed)
;



return this.bootstrap(module, script);
};

Expand Down
2 changes: 2 additions & 0 deletions test/expected/callback_module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('test.fixtures.one.html').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one',
"<h1>One</h1>\n" +
Expand All @@ -15,6 +16,7 @@ angular.module('test.fixtures.one.html').run(['$templateCache', function($templa
}]);

angular.module('test.fixtures.two.two.html').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/two/two',
"<h2>Two</h2>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_angular.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
myAngular.module('custom_angular').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


angular.module('custom_concat').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_htmlmin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('custom_htmlmin').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1><p>I am one.</p><script>// Test\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('customModule').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_prefix.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('custom_prefix').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('/static/test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_source.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('custom_source').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<!-- Template: test/fixtures/one.html -->\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/custom_url.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('custom_url').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/default_module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('default_module').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/empty_file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('empty_file').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/empty.html',
""
Expand Down
1 change: 1 addition & 0 deletions test/expected/full_url.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('full_url').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/html5.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('html5').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/html5.html',
"<div>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/relative_url.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('relative_url').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/standalone.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('standalone', []).run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1>\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/task_htmlmin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('task_htmlmin').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/one.html',
"<h1>One</h1><p>I am one.</p><script>// Test\n" +
Expand Down
1 change: 1 addition & 0 deletions test/expected/undefined_file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('undefined_file').run(['$templateCache', function($templateCache) {
'use strict';

$templateCache.put('test/fixtures/undefined.html',
"<h1>Undefined</h1>\n" +
Expand Down

0 comments on commit 147a9ad

Please sign in to comment.