Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usestrict option to include 'use strict'; in output #58

Merged
merged 2 commits into from
Dec 1, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,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