Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to use ES Modules + Rollup (CJS, ESM, UMD) + Babel + ESLint/Prettier #118

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

dmnsgn
Copy link

@dmnsgn dmnsgn commented May 25, 2018

This is a big one: it includes a lot of changes and some stylistic ones so I'd understand if you don't like some of them and you might also not have the time to review it but I figured I tried. Also I have seen you were interested in switching to ES modules (#102) so here it is:

  • Refactor to use ES Modules
  • Use Rollup to get three bundles CJS, ESM, UMD
  • Use Babel and encourage the use of babel-polyfill
  • ESLint/Prettier for code consistency
  • Remove Grunt in favour of Rollup
  • Remove Closure Compiler in favour of Babel
  • Use JSDoc to generate a documentation: https://dmnsgn.github.io/fontfaceobserver/

All tests are the same and passing in Node 4 to 8: https://travis-ci.org/dmnsgn/fontfaceobserver

You can see the output bundles keep a small size gzipped:

I published it on npm to have a play: https://www.npmjs.com/package/fontfaceobserver-es

Thanks

@gmcdev
Copy link

gmcdev commented Nov 9, 2018

Nice freaking work, dude! Saving my life right now, since my project compiles with webpack and rollup. Of course it was freaking out about the commonjs export.

@bennypowers
Copy link

It would be wonderful if this was published as es modules.

* 'master' of https://github.com/bramstein/fontfaceobserver:
  2.1.0
  Add dist files.
  Fix calling phantomjs.
  Upgrade Grunt and Mocha.
  Reject promises with Error objects
  Adds an example of dynamically creating observers, closes bramstein#121

# Conflicts:
#	Gruntfile.js
#	fontfaceobserver.js
#	fontfaceobserver.standalone.js
#	package-lock.json
#	package.json
#	src/observer.js
#	test/observer-test.js
@dmnsgn
Copy link
Author

dmnsgn commented Mar 17, 2019

Updated with latest commits and fixes: https://unpkg.com/fontfaceobserver-es@3.3.1/dist/fontfaceobserver.esm.js

Fixed all the tests

Available to test from at: npm i fontfaceobserver-es

@scsskid
Copy link

scsskid commented Aug 14, 2019

thanks!

@sandinosaso
Copy link

Can I help anyway to make this PR merged? I think this is very important, Currently many projects use webpack or rollup, and having this library not being tree shakable is a big down for those.

In our case, we detected that our bundle size incremented > 40% due to just use this library, and we are investigating to move away from it for this very reason.

@tiye
Copy link

tiye commented Feb 5, 2021

Thanks for the package fontfaceobserver-es .

@danimalweb
Copy link

Love to see this merged, please?

taylrj added a commit to taylrj/twreporter-npm-packages that referenced this pull request Aug 3, 2022
This change adds `fontobserver-es` npm module monitor when a webfont is loaded and notify.
Please note that it is different from `fontfaceobserver` module, we
choose `fontobserver-es` because it's an es module.

ref:
- bramstein/fontfaceobserver#118
- https://github.com/dmnsgn/fontfaceobserver
taylrj added a commit to taylrj/twreporter-npm-packages that referenced this pull request Aug 10, 2022
This change adds `fontobserver-es` npm module monitor when a webfont is loaded and notify.
Please note that it is different from `fontfaceobserver` module, we
choose `fontobserver-es` because it's an es module.

ref:
- bramstein/fontfaceobserver#118
- https://github.com/dmnsgn/fontfaceobserver
@rafagsiqueira
Copy link

I can also confirm fontfaceobserver-es works when using the following import:
import FontFaceObserver from 'fontfaceobserver-es';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants