Skip to content

Commit

Permalink
Publish the lib also as a es2015 module
Browse files Browse the repository at this point in the history
  • Loading branch information
fazouane-marouane committed Oct 29, 2017
1 parent 4b7cb61 commit 1f08811
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
es2015/

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

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

## 1.2.3

* Provide the lib as a ES2015 module and umd module to please everyone.
* explain more HOWTOs in the README

## 1.2.2

* Change the build system

## 1.2.1

* Usage of a custom LRU cache implementation. The old one was way too heavy and needed polyfills.
Expand Down
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ npm install --save fancy-textfill
```html
<!-- In case you're using it as a jquery plugin -->
<script src="jquery.min.js"></script>
<script src="fancy-text-fill.jQuery.js"></script>
<!-- Or you can use it without jquery -->
<script src="fancy-text-fill.js"></script>
<script src="https://unpkg.com/fancy-textfill/dist/fancy-text-fill.jQuery.js"></script>
<!-- Or you can use it without jquery, by using https://unpkg.com/fancy-textfill/dist/fancy-text-fill.js -->
<!-- Example setup -->
<style>
.container {
Expand Down Expand Up @@ -59,6 +58,28 @@ $('.myText').fancyTextFill({
});
```

You can also use it as a module. You can import it like so:

```js
// Without jquery
import { fillParentContainer } from 'fancy-textfill';
// Or const { fillParentContainer } = require('fancy-textfill');
fillParentContainer(el, {
minFontSize: 6,
maxFontSize: 26
});
```

```js
// as a jquery plugin
import 'fancy-textfill/es2015/jquery.plugin';
// Or require('fancy-textfill/es2015/jquery.plugin');
$('.myText').fancyTextFill({
minFontSize: 6,
maxFontSize: 26
});
```

## Options

| Name | Description | Default value |
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "fancy-textfill",
"version": "1.2.2",
"version": "1.2.3",
"description": "Fast implementation for resizing text to fill its container.",
"main": "dist/fancy-text-fill.js",
"main": "es2015/index.js",
"repository": "https://github.com/fazouane-marouane/fancy-textfill",
"author": "Fazouane Marouane",
"license": "MIT",
Expand All @@ -19,7 +19,7 @@
}
},
"scripts": {
"build": "neutrino build",
"build": "neutrino build && tsc --outDir es2015",
"test": "NODE_ENV=development intern-runner config=test/intern"
},
"devDependencies": {
Expand All @@ -34,6 +34,7 @@
},
"files": [
"dist/fancy-text-fill.js",
"dist/fancy-text-fill.jQuery.js"
"dist/fancy-text-fill.jQuery.js",
"es2015/*"
]
}

0 comments on commit 1f08811

Please sign in to comment.