wycats / rake-pipeline-web-filters

MIT License
116 stars 36 forks source link

Add "use strict" as an option for minispade filter #1

Closed jamesarosen closed 12 years ago

jamesarosen commented 12 years ago

It's a good general practice to add "use strict"; to the top of each major function. It would be nice to have a strict option on the filter that would add it just inside the function() { } wrapper.

Why not just have the user put it in each source file? Because global "use strict"; is a bad idea, so things like JSHint expect it to be inside a function() {}() call. To do this in the source files means that each source file would have to look like

(function() {
  "use strict";
  ...
}());

which would then get compiled to

minispade.register('filename', function() {
  (function() {
    "use strict";
    ...
  }());
});

There's nothing wrong with that, but it seems wasteful.

wagenet commented 12 years ago

Seems fine to set up some options for minispade filter. I suspect you're well equipped to make a pull request for that :)