foundation-apps
foundation-apps copied to clipboard
Syntax error when requiring in Browserify
I'm installing foundation-apps from npm (v1.1.0), but when requiring dist/js/foundation-apps.js with Browserify I get the following error:
SyntaxError: Unexpected token (7:1228) while parsing /Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/foundation-apps/dist/js/foundation-apps.js while parsing file: /Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/foundation-apps/dist/js/foundation-apps.js
at DestroyableTransform.end [as _flush] (/Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/browserify/node_modules/insert-module-globals/index.js:79:21)
at DestroyableTransform.<anonymous> (/Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/browserify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:135:12)
at DestroyableTransform.g (events.js:199:16)
at DestroyableTransform.emit (events.js:104:17)
at prefinish (/Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/browserify/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:450:12)
at finishMaybe (/Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/browserify/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:458:7)
at endWritable (/Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/browserify/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:469:3)
at DestroyableTransform.Writable.end (/Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/browserify/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:436:5)
at DestroyableTransform.onend (/Users/jviotti/Projects/IssueTrack/issuetrack/node_modules/browserify/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:537:10)
at DestroyableTransform.g (events.js:199:16)
I've un-minified the part of the script throwing the error and I see the following invalid JavaScript:
case "iconic-fluid":
d.push(a), e.push(a.replace(/-/, "-bg-"));
break;
The actual error is being thrown in this part:
f.each = function(a) {
if (a)
if ("string" == typeof a) h.debug(a);
else if (a instanceof SVGSVGElement) {
var c = a.getAttribute("data-icon");
if (c && j[c]) {
var d = j[c](a);
for (var e in d) a[e] = d[e]
}
/iconic-bg-/.test(a.getAttribute("class")) && g.addBackground(a), m(a), k++, b && b.each && "function" == typeof b.each && b.each(a)
}
}, "string" == typeof a && (a = document.querySelectorAll(a)), c(a, f, e)
I believe this comes from Iconic, but has a lot of syntax issues.
It's issue #625