miickel / gulp-angular-templatecache

Concatenates and registers AngularJS templates in the $templateCache.
MIT License
525 stars 103 forks source link

Minification is stripping the basic IIFE wrapper from the cached templates #161

Closed dmellstrom closed 6 years ago

dmellstrom commented 6 years ago

My issue is with the moduleSystem option, value 'IIFE'.

When minifying a build containing concatenated cached templates provided by this plugin, using UglifyJS, the functional wrapper is removed from the prepared templates.

simonua commented 6 years ago

While I principally tend to agree with this change, I'm wondering whether introducing strict mode in the function context might break sloppy code contained in the IIFE.

simonua commented 6 years ago

We currently don't have any tests for IIFE. IMHO, this would necessitate adding some coverage.

dmellstrom commented 6 years ago

In theory, there won't be any sloppy or even non-static code contained in the IIFE, as it will just contain the template strings plus the surrounding Angular boilerplate added by this plugin. However, I concur that test coverage for IIFE is a good idea. I will add a relevant commit to my PR.

simonua commented 6 years ago

@dmellstrom, thanks very much for adding the test.