Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit c03280a

Browse files
author
Bernhard Grünewaldt
committed
working version with assets copied from emojify.js during pre-publish phase
1 parent c501ea0 commit c03280a

File tree

6 files changed

+40
-13
lines changed

6 files changed

+40
-13
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# GitBook Plugin: Advanced Emoji
22

3-
Transforms emoji like `:white_check_mark:` into emoji images.
3+
Transforms emojis like `:white_check_mark:` into real :white_check_mark: emoji images using [emojify.js](https://github.com/hassankhan/emojify.js).
44

5+
## Installation
56

67
You can install this plugin via npm:
78

@@ -17,8 +18,18 @@ Be sure to activate the option from the `book.json` file:
1718
}
1819
```
1920

21+
Then run `gitbook install` followed by either `gitbook serve` or `gitbook build`
2022

2123

2224
## License
2325

24-
Apache License Version 2.0,
26+
* https://github.com/codeclou/gitbook-plugin-advanced-emoji is licensed under MIT License
27+
* https://github.com/hassankhan/emojify.js is licensed under MIT License
28+
29+
## Publishing to npmjs.com
30+
31+
```
32+
npm install # install dependencies
33+
npm run pre-publish # copies emoji pngs and css to assets folder
34+
npm run publish # publishes to npmjs.com
35+
```

assets/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
emojify.css
2+
emojis

book/plugin.css

Lines changed: 0 additions & 7 deletions
This file was deleted.

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module.exports = {
22
website: {
3-
assets: "./node_modules/emojify.js/dist/images/basic/",
3+
assets: "./assets",
44
js: [ ],
55
css: [
6-
"plugin.css"
6+
"emojify.css"
77
]
88
},
99

@@ -12,7 +12,7 @@ module.exports = {
1212
hooks: {
1313
"page:before": function(page) {
1414
var emojify = require("emojify.js");
15-
emojify.setConfig({img_dir : '/gitbook/plugins/gitbook-plugin-advanced-emoji/'});
15+
emojify.setConfig({img_dir : '/gitbook/plugins/gitbook-plugin-advanced-emoji/emojis/'});
1616
page.content = emojify.replace(page.content);
1717
return page;
1818
}

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gitbook-plugin-advanced-emoji",
33
"description": "Shows the common emojis used on GitHub",
44
"main": "index.js",
5-
"version": "0.0.6",
5+
"version": "0.1.0",
66
"engines": {
77
"gitbook": ">=2.5.0"
88
},
@@ -26,5 +26,11 @@
2626
},
2727
"dependencies": {
2828
"emojify.js": "^1.1.0"
29+
},
30+
"scripts": {
31+
"pre-publish": "node ./pre-publish.js"
32+
},
33+
"devDependencies": {
34+
"fs-extra": "^0.26.2"
2935
}
3036
}

pre-publish.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var fse = require('fs-extra');
2+
3+
fse.copy('./node_modules/emojify.js/dist/images/basic', './assets/emojis', function (err) {
4+
if (err) {
5+
return console.error(err);
6+
}
7+
console.log("success!");
8+
});
9+
10+
fse.copy('./node_modules/emojify.js/dist/css/basic/emojify.css', './assets/emojify.css', function (err) {
11+
if (err) {
12+
return console.error(err);
13+
}
14+
console.log("success!");
15+
});

0 commit comments

Comments
 (0)