1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-11-16 20:25:58 +00:00

Compare commits

..

No commits in common. "e0ca0b7a869ab2af6b03b7430d61c8b5b352edec" and "2915b86fb8a8d33b7b17017e216dcc658e80aad2" have entirely different histories.

10 changed files with 1074 additions and 1465 deletions

7
.gitignore vendored
View File

@ -3,10 +3,3 @@ node_modules/
build
dist/
.npmrc
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

View File

@ -1 +0,0 @@
nodeLinker: node-modules

View File

@ -10,21 +10,19 @@ The Twemoji library offers support for all Unicode-defined emoji which are recom
### CDN Support
<del>The folks over at [MaxCDN](https://www.maxcdn.com) have graciously provided CDN support.</del>
MaxCDN is shut down right now, so in the meanwhile use a different CDN or download the assets. (See [Maxcdn has shut down, cdn not working anymore. · Issue #580 · twitter/twemoji](https://github.com/twitter/twemoji/issues/580)).
The folks over at [MaxCDN](https://www.maxcdn.com) have graciously provided CDN support.
Use the following in the `<head>` tag of your HTML document(s):
```html
<script src="https://unpkg.com/twemoji@latest/dist/twemoji.min.js" crossorigin="anonymous"></script>
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
```
This guarantees that you will always use the latest version of the library.
If, instead, you'd like to include the latest version explicitly, you can add the following tag:
```html
<script src="https://unpkg.com/twemoji@14.0.2/dist/twemoji.min.js" integrity="sha384-ICOlZarapRIX6UjKPcWKEpubjg7lGADN7Y9fYP4DU9zm0aPFhgnP5ef+XFaPyKv+" crossorigin="anonymous"></script>
<script src="https://twemoji.maxcdn.com/v/14.0.2/twemoji.min.js" integrity="sha384-32KMvAMS4DUBcQtHG6fzADguo/tpN1Nh6BAJa2QqZc6/i0K+YPQE+bWiqBRAWuFs" crossorigin="anonymous"></script>
```
### Download

2
index.d.ts vendored
View File

@ -13,7 +13,7 @@ export type ReplacerFunction = (substring: string, ...args: any[]) => string;
export type TwemojiOptions = {
/**
* Default: Cloudflare
* Default: MaxCDN
*/
base?: string;
/**

View File

@ -44,7 +44,7 @@
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>Code licensed under MIT. Graphics licensed under CC-BY</p>
<script src="https://unpkg.com/twemoji@latest/dist/twemoji.min.js"></script>
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js"></script>
<script>
// I \u2764 emoji!
twemoji.parse(document.body);

View File

@ -47,7 +47,7 @@ function createTwemoji() {
/////////////////////////
// default assets url, by default will be Twitter Inc. CDN
base: 'https://cdnjs.cloudflare.com/ajax/libs/twemoji/$VERSION/',
base: 'https://twemoji.maxcdn.com/v/$VERSION/',
// default assets file extensions, by default '.png'
ext: '.png',

View File

@ -39,7 +39,7 @@ fs.writeFileSync(
);
spawnSync(
'yarn',
'yarnpkg',
[
'uglifyjs',
'--verbose',
@ -60,7 +60,7 @@ const integrityHash = getIntegrityHash(distFile('twemoji.min.js'));
const { version } = require('../package.json');
function updateSriScriptReference(filename) {
const newScript = `<script src="https://unpkg.com/twemoji@${version}/dist/twemoji.min.js" integrity="${integrityHash}"`;
const newScript = `<script src="https://twemoji.maxcdn.com/v/${version}/twemoji.min.js" integrity="${integrityHash}"`;
fs.writeFileSync(filename, fs.readFileSync(filename).toString('utf8').replace(/<script src="[^ ]*" integrity="[^ ]*"/, newScript));
}

View File

@ -25,7 +25,7 @@
vertical-align: -0.1em;
}
</style>
<script src="https://unpkg.com/twemoji@latest/dist/twemoji.min.js" crossorigin="anonymous"></script>
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
</head>
<body>
<ul class="emoji-list">

View File

@ -225,7 +225,7 @@ wru.test([{
},{
name: 'nested nodes',
test: function () {
var str = '<img class="emoji" draggable="false" alt="\u2764" src="https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/2764.png"/>',
var str = '<img class="emoji" draggable="false" alt="\u2764" src="https://twemoji.maxcdn.com/72x72/2764.png"/>',
div = document.createElement('div'),
p,
img;

2509
yarn.lock

File diff suppressed because it is too large Load Diff