Closed ktarplee closed 8 years ago
Could you just use:
wiredep({
fileTypes: {
html: {
replace: {
js: '<script async src="{{filePath}}"></script>'
}
}
}
});
?
I only want to async load a particular dependencies. It seems this would async load all dependencies (that would likely break things).
How about excluding it, and manually writing the script tag outside of the bower:js block?
That is how I am currently fixing it but it has negative rippling effects to the rest of the Gruntfile (for instance). I wonder if this is really a property of the script to be loaded as opposed to a property of the html file loading the script or the Gruntfile? Should the bower.json file include an indication that this is asm.js and then wiredep load it with async so that tools can cache it? I don't really like this idea... I think it should be explicit. I think the decision of when to load scripts sync vs async is application dependent.
I don't really think this should be handled here. stephen's idea sounds right. Sounds like your gruntfile needs some slight tweaking to be able to handle that. Also, if you are using gruntfile to concat files then it would kill the async tag if you bundle it with other things anyway.
For asm.js code you need to load it with
<script async src="foo.js"></script>
so that Firefox will cache the code. It would nice if wiredep supported this functionality in some way.