I鈥檝e scoured the documentation and source code for hours but can find no way of getting the NPM versions of FA v5 (free and pro) to work in the browser. 馃槥 Is there any way to use the packages _without_ using a module loader? The packages are UMD modules and the examples in the docs suggest it should be doable but I鈥檝e had no luck.
All I'm trying to do is implement the SVG+Javascript usage but using the NPM packages. This seems like such a basic use case that I can't help but think I must be doing something wrong:
<i class="fas fa-bug"></i>
<script src="node_modules/@fortawesome/fontawesome/index.js"></script>
<script src="node_modules/@fortawesome/fontawesome-free-solid/index.js"></script>
<script>
  (function () {
    var faFreeSolid = window['fontawesome-free-solid']
    // This doesn鈥檛 work at all.
    fontawesome.library.add(faFreeSolid)
    fontawesome.dom.i2svg()
    // Tried this too and got a missing-icon icon, at least.
    ___FONT_AWESOME___.styles[faFreeSolid.prefix] = faFreeSolid.default
    fontawesome.dom.i2svg()
  })()
</script>
The files in the v5 zip download work great, but oddly enough they seem to be different than the files in the packages. Specifically, index.js (from the package) is missing all the bootstrap() code that makes fontawesome.js (from the download) work鈥攁nd both files claim to be v5.0.1.
Is there any way to use Font Awesome v5 without using a module loader or checking the downloaded files into source control?
A example project demonstrating the issue: font-awesome-npm-usage.zip
Hey @seanCodes we're working on this right now. In the meantime if you switch to the files from the downloadable .ZIP in the svg-with-js you'll get a much better experience.
@robmadole Glad to hear it鈥檚 being actively worked on! I'm aware that the ZIP version works properly, but like I mentioned I鈥檇 rather not include those files in my repo if I can help it. Any idea what the ETA might be? Would the fact that I'm a paying pro user help it happen any faster? 馃槤
Thanks for all the great work on FA5!
is this fixed yet ?
@spmsupun please test against version 5.0.2 and let me know
@tagliala still not working
let fontawesome = require('@fortawesome/fontawesome');
let faBell = require('@fortawesome/fontawesome-free-solid/faBell');
fontawesome.icon(faBell);
fontawesome.dom.i2svg(); //tested with and without this
//html
<i class="fas fa-bell"></i>
<i class="fa fa-bell"></i>
@tagliala @seanCodes now its working, had to do small modification
require('@fortawesome/fontawesome');
require('@fortawesome/fontawesome-free-solid');
without adding into a variable it's automatically converting all the icon
Most helpful comment
@tagliala @seanCodes now its working, had to do small modification
without adding into a variable it's automatically converting all the icon