Skip to content

Commit

Permalink
chore: add 'use strict' in a IIFE
Browse files Browse the repository at this point in the history
  • Loading branch information
frapontillo committed Apr 1, 2015
1 parent 210b5c0 commit 0bddd03
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,18 @@ module.exports = function (grunt) {
},
concat: {
options: {
banner: '<%= meta.banner %>\'use strict\';\n',
banner: '<%= meta.banner %>',
process: function(src, filepath) {
// don't strip 'use strict' in the prefix
if (filepath === 'bsSwitch.prefix') {
return src;
}
return '// Source: ' + filepath + '\n' +
src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
}
},
dist: {
src: ['common/*.js', '<%= yeoman.dist %>/<%= yeoman.temp %>/**/*.js'],
src: ['bsSwitch.prefix', 'common/*.js', '<%= yeoman.dist %>/<%= yeoman.temp %>/**/*.js', 'bsSwitch.suffix'],
dest: '<%= yeoman.dist %>/<%= pkg.name %>.js'
}
},
Expand Down
2 changes: 2 additions & 0 deletions bsSwitch.prefix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(function() {
'use strict';
1 change: 1 addition & 0 deletions bsSwitch.suffix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
})();
4 changes: 3 additions & 1 deletion common/module.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
angular.module('frapontillo.bootstrap-switch', []);
'use strict';

angular.module('frapontillo.bootstrap-switch', []);

0 comments on commit 0bddd03

Please sign in to comment.