Skip to content

Commit

Permalink
Add module support
Browse files Browse the repository at this point in the history
  • Loading branch information
maxulyanov committed Feb 1, 2017
1 parent 1e0e5c2 commit 305adc1
Show file tree
Hide file tree
Showing 3 changed files with 294 additions and 260 deletions.
63 changes: 41 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,51 @@ ImageComparison
Slider to quickly compare two images


##Getting started
1. `npm install image-comparison --save`
2. Include style `node_modules/image-comparison/src/ImageComparison.css`
3. Call ImageComparison with your options:

## Install
```bash
$ npm install image-comparison
```

## Usage
Once you have downloaded ImageComparison, the first thing you need to do is include the CSS and the JavaScript.

### CSS
```html
<link rel="stylesheet" href="path/ImageComparison.css">
```

### JavaScript
```html
<script src="path/ImageComparison.js"></script>
<script>
import { ImageComparison } from './ImageComparison';
new ImageComparison({
container: containerSelector,
startPosition: 70,
data: [
{
image: images[0],
label: 'before'
},
{
image: images[1],
label: 'after'
}
],
});
new ImageComparison({
container: containerSelector,
startPosition: 70,
data: [
{
image: images[0],
label: 'before'
},
{
image: images[1],
label: 'after'
}
],
});
</script>
```
4. For support UMD use - `https://babeljs.io/docs/plugins/transform-es2015-modules-umd/`
5. Using!

### commonJS
```js
var ImageComparison = require('ImageComparison');
```

### ES6
```js
import ImageComparison from 'ImageComparison';
```


##Options
Options list:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "image-comparison",
"version": "2.0.0",
"version": "2.0.2",
"description": "Slider to quickly compare two images",
"main": "index.js",
"main": "src/ImageComparison.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down
Loading

0 comments on commit 305adc1

Please sign in to comment.