Commit Graph

5 Commits

Author SHA1 Message Date
Cole Bemis
c978b1cb4e fix: Remove unused polyfills and update build config
Removes polyfills for `Object.assign` and `Set` which, as far as I can tell, are unused in the
codebase. Updates `webpack` from 3 to 4. Replaces `babel-preset-es2015` with `babel-preset-env`.
Reduces the minified bundle size (`feather.min.js`) by **9.3kB** (72.4kB to 63.1kB). Does not change
any functionality of the library.
2018-05-18 12:26:21 -07:00
Cole Bemis
f243624fbd
feat: Update API
BREAKING CHANGE: 

Each icon in the `feather.icons` object is now an `Icon` object with a `name`, `contents`, `tags` and `attrs` property.
```js
/* BEFORE */
feather.icons.x
// '<line ... /><line ... />'

/* AFTER */
feather.icons.x
// {
//    name: 'x',
//    contents: '<line ... /><line ... />`,
//    tags: ['cancel', 'close', 'delete', 'remove'],
//    attrs: {
//      class: 'feather feather-x',
//      xmlns: 'http://www.w3.org/2000/svg',
//      width: 24,
//      height: 24,
//      viewBox: '0 0 24 24',
//      fill: 'none',
//      stroke: 'currentColor',
//      'stroke-width': 2,
//      'stroke-linecap': 'round',
//      'stroke-linejoin': 'round',
//    }
// }
```

`feather.toSvg()` has been deprecated in favor of `feather.icons[name].toSvg()`:
```js
/* BEFORE */
feather.toSvg('x')

/* AFTER */
feather.icons.x.toSvg()
```

`feather.replace()` now copies all attributes on the placeholder element (i.e. `<i>`) to the `<svg>` tag instead of just `class` and `id`:

```html
<i data-feather="circle" id="my-circle" class="foo bar" stroke-width="1"></i>
<!--
<i> will be replaced with:
<svg id="my-circle" class="feather feather-circle foo bar" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle></svg>
-->
```
2017-11-18 20:00:16 -08:00
Cole Bemis
ae164db70f build: Add script to build dist/icons.json 2017-07-03 15:53:34 -07:00
Cole Bemis
e1ea1aada8 Clear gh-pages branch 2017-02-21 22:45:06 -08:00
Cole Bemis
9cbd7ca24d Set up babel 2017-01-28 14:46:21 -08:00