Skip to content

Commit

Permalink
eslint, prettier, terser
Browse files Browse the repository at this point in the history
  • Loading branch information
morris committed May 4, 2019
1 parent 74fce03 commit baaeb6f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
env: {
browser: true
},
extends: "eslint:recommended",
parserOptions: {
ecmaVersion: 5
}
};
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
package-lock.json
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```
The MIT License (MIT)
Copyright (c) 2015-2016 Morris Brodersen <[email protected]>
Copyright (c) 2015-2019 Morris Brodersen <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ better UX for slow or offline connections.
The same requests are sent as in loading a Typekit regularly, and the Typekit embed code is unaltered.
However, using this script may still violate the [Typekit Terms Of Use][tou].


## Usage

Copy the contents of [typekit-cache.min.js][min] right before your Typekit (advanced) embed code.
That's it, your website should be caching your Typekit happily.

```html
<script>
!function(e,t,n,a,c,l,m,o,d,f,h,i){ /* ... */ }( /* ... */ );
!function(e,t,n,a,l,m,c,o,s,d,g,i){ /* ... */ }( /* ... */ );
</script>
<script>
(function(d) {
Expand All @@ -30,7 +29,6 @@ That's it, your website should be caching your Typekit happily.
</script>
```


## Notes

The regular Typekit behavior is not modified at all.
Expand All @@ -41,13 +39,11 @@ In addition to the regular `wf-*` classes, the `wf-cached` class is added to the

To use `sessionStorage` instead, just replace the `localStorage` reference.


## Contributing

Make sure PRs contain an updated minified version.
Run `npm run prepublish` to build it.


## Contributors

- [Artem Gordinsky](https://github.com/ArtemGordinsky)
Expand All @@ -59,7 +55,6 @@ Run `npm run prepublish` to build it.

Thanks!


[tk]: https://typekit.com/
[tou]: http://www.adobe.com/products/eulas/tou_typekit/
[min]: https://raw.githubusercontent.com/morris/typekit-cache/master/typekit-cache.min.js
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{
"name": "typekit-cache",
"version": "1.13.0",
"version": "1.14.0",
"description": "Keeps a site's Typekit in localStorage and injects it on page load. Eliminates the annoying Flash Of Invisible/Unstyled Text (FOUT) and provides better UX for slow or offline connections.",
"main": "typekit-cache.js",
"directories": {
"test": "test"
},
"dependencies": {
"uglifyjs": "^2.4.10"
"devDependencies": {
"eslint": "^5.16.0",
"prettier": "^1.17.0",
"terser": "^3.17.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "uglifyjs typekit-cache.js -o typekit-cache.min.js --compress --mangle"
"format": "prettier --write typekit-cache.js",
"lint": "eslint typekit-cache.js",
"build": "terser typekit-cache.js -o typekit-cache.min.js --compress --mangle",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit baaeb6f

Please sign in to comment.