mirror of
https://github.com/twitter/twemoji.git
synced 2024-11-02 11:30:12 +00:00
avoid errors when required via node and no location is present
This commit is contained in:
parent
db01efff07
commit
a8ad0e4e07
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"name": "twemoji",
|
||||
"license": ["MIT", "CC-BY-4.0"],
|
||||
"description": "A Unicode standard based way to implement emoji across all platforms.",
|
||||
|
@ -8,7 +8,14 @@ var fs = require('fs');
|
||||
|
||||
fs.writeFileSync(
|
||||
'twemoji.npm.js',
|
||||
fs.readFileSync('twemoji.js') + '\nmodule.exports = twemoji;'
|
||||
[
|
||||
'var location = global.location || {};',
|
||||
fs.readFileSync('twemoji.js'),
|
||||
'if (!location.protocol) {',
|
||||
' twemoji.base = twemoji.base.replace(/^http:/, "");',
|
||||
'}',
|
||||
'module.exports = twemoji;'
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
fs.writeFileSync(
|
||||
|
@ -1,3 +1,4 @@
|
||||
var location = global.location || {};
|
||||
/*jslint indent: 2, browser: true, bitwise: true, plusplus: true */
|
||||
var twemoji = (function (
|
||||
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//*
|
||||
@ -510,4 +511,7 @@ var twemoji = (function (
|
||||
}
|
||||
|
||||
}());
|
||||
if (!location.protocol) {
|
||||
twemoji.base = twemoji.base.replace(/^http:/, "");
|
||||
}
|
||||
module.exports = twemoji;
|
Loading…
Reference in New Issue
Block a user