Skip to content

Commit 1f08811

Browse files
Publish the lib also as a es2015 module
1 parent 4b7cb61 commit 1f08811

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dist/
2+
es2015/
23

34
# Created by https://www.gitignore.io/api/node,visualstudiocode,macos
45

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log
22

3+
## 1.2.3
4+
5+
* Provide the lib as a ES2015 module and umd module to please everyone.
6+
* explain more HOWTOs in the README
7+
8+
## 1.2.2
9+
10+
* Change the build system
11+
312
## 1.2.1
413

514
* Usage of a custom LRU cache implementation. The old one was way too heavy and needed polyfills.

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ npm install --save fancy-textfill
2020
```html
2121
<!-- In case you're using it as a jquery plugin -->
2222
<script src="jquery.min.js"></script>
23-
<script src="fancy-text-fill.jQuery.js"></script>
24-
<!-- Or you can use it without jquery -->
25-
<script src="fancy-text-fill.js"></script>
23+
<script src="https://unpkg.com/fancy-textfill/dist/fancy-text-fill.jQuery.js"></script>
24+
<!-- Or you can use it without jquery, by using https://unpkg.com/fancy-textfill/dist/fancy-text-fill.js -->
2625
<!-- Example setup -->
2726
<style>
2827
.container {
@@ -59,6 +58,28 @@ $('.myText').fancyTextFill({
5958
});
6059
```
6160

61+
You can also use it as a module. You can import it like so:
62+
63+
```js
64+
// Without jquery
65+
import { fillParentContainer } from 'fancy-textfill';
66+
// Or const { fillParentContainer } = require('fancy-textfill');
67+
fillParentContainer(el, {
68+
minFontSize: 6,
69+
maxFontSize: 26
70+
});
71+
```
72+
73+
```js
74+
// as a jquery plugin
75+
import 'fancy-textfill/es2015/jquery.plugin';
76+
// Or require('fancy-textfill/es2015/jquery.plugin');
77+
$('.myText').fancyTextFill({
78+
minFontSize: 6,
79+
maxFontSize: 26
80+
});
81+
```
82+
6283
## Options
6384

6485
| Name | Description | Default value |

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "fancy-textfill",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "Fast implementation for resizing text to fill its container.",
5-
"main": "dist/fancy-text-fill.js",
5+
"main": "es2015/index.js",
66
"repository": "https://github.com/fazouane-marouane/fancy-textfill",
77
"author": "Fazouane Marouane",
88
"license": "MIT",
@@ -19,7 +19,7 @@
1919
}
2020
},
2121
"scripts": {
22-
"build": "neutrino build",
22+
"build": "neutrino build && tsc --outDir es2015",
2323
"test": "NODE_ENV=development intern-runner config=test/intern"
2424
},
2525
"devDependencies": {
@@ -34,6 +34,7 @@
3434
},
3535
"files": [
3636
"dist/fancy-text-fill.js",
37-
"dist/fancy-text-fill.jQuery.js"
37+
"dist/fancy-text-fill.jQuery.js",
38+
"es2015/*"
3839
]
3940
}

0 commit comments

Comments
 (0)