diff --git a/2/templates/preview.html b/2/templates/preview.html new file mode 100644 index 00000000..e82d07d6 --- /dev/null +++ b/2/templates/preview.html @@ -0,0 +1,47 @@ + + + + Twitter Emoji (Twemoji) Preview + + + + + + + + + diff --git a/2/test/preview-svg.html b/2/test/preview-svg.html new file mode 100644 index 00000000..c41d8f48 --- /dev/null +++ b/2/test/preview-svg.html @@ -0,0 +1,1707 @@ + + + + Twitter Emoji (Twemoji) Preview + + + + + + + + + diff --git a/2/test/preview.html b/2/test/preview.html new file mode 100644 index 00000000..bbf0e455 --- /dev/null +++ b/2/test/preview.html @@ -0,0 +1,1707 @@ + + + + Twitter Emoji (Twemoji) Preview + + + + + + + + + diff --git a/2/utils/create-dist b/2/utils/create-dist index 1e615d87..49c5b496 100755 --- a/2/utils/create-dist +++ b/2/utils/create-dist @@ -8,7 +8,7 @@ var fs = require('fs'); var path = require('path'); function file(which) { - return path.join(__dirname, '../', which); + return path.join(__dirname, '..', which); } fs.writeFileSync( diff --git a/2/utils/generate b/2/utils/generate index 418ccd27..48cc9412 100755 --- a/2/utils/generate +++ b/2/utils/generate @@ -10,7 +10,7 @@ var http = require('http'); var path = require('path'); function file(which) { - return path.join(__dirname, '../../', which); + return path.join(__dirname, '../..', which); } // Twitter assets by property name diff --git a/2/utils/preview b/2/utils/preview new file mode 100755 index 00000000..3d6ef07a --- /dev/null +++ b/2/utils/preview @@ -0,0 +1,44 @@ +#!/usr/bin/env node + +/*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//* + https://github.com/twitter/twemoji/blob/gh-pages/LICENSE +*/ + +// dependencies +var fs = require('fs'); +var path = require('path'); + +function file(which) { + return path.join(__dirname, '..', which); +} + +fs.readdir(file('assets'), function (err, files) { + var page = fs.readFileSync(file('templates/preview.html')).toString().replace( + '{{emoji-list}}', + '
  • ' + files.map(function (file) { + return file.replace('.ai', '').split('-').map(function (hex) { + return '&#x' + hex.toUpperCase() + ';'; + }).join(''); + }).join('
  • \n
  • ')+ '
  • ' + ); + fs.writeFileSync( + file('test/preview.html'), + page.replace( + '{{emoji-options}}', + JSON.stringify({ + size: 72 + }) + ) + ); + fs.writeFileSync( + file('test/preview-svg.html'), + page.replace( + '{{emoji-options}}', + JSON.stringify({ + folder: 'svg', + ext: '.svg', + base: '' + }) + ) + ); +}); \ No newline at end of file