Disable loopProtect for non-JavaScript code

This commit is contained in:
Leon Feng
2017-01-31 05:30:23 +04:00
parent 43d69e0e44
commit 30bc87c1da

View File

@ -24,6 +24,11 @@ const transformersForHtmlJS = {
{
name: 'add-loop-protect',
transformer: function addLoopProtect(file) {
const _contents = file.contents.toLowerCase();
if (file.ext === 'html' && !_contents.includes('<script>')) {
// No JavaScript in user code, so no need for loopProtect
return updateContents(file.contents, file);
}
return updateContents(loopProtect(file.contents), file);
}
},