Skip to content

Commit f6bf996

Browse files
Add instructions on importing with webpack
Closes #38
1 parent 4d3c623 commit f6bf996

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ differences:
2929
3. Includes bug fixes not present in [fat/zoom.js][fat-zoom], which is no
3030
longer being maintained
3131

32-
## Usage
32+
## Installation
3333

3434
1. Download the JS and CSS files using any of the following methods:    
3535

36-
- npm: `npm i -D zoom-vanilla.js`. This will download the the necessary
36+
- npm: `npm i zoom-vanilla.js`. This will download the the necessary
3737
files to the `node_modules/zoom-vanilla.js/dist/` directory.
3838

3939
- Directly link to the files hosted on a CDN:
@@ -56,13 +56,22 @@ differences:
5656
<script src="path/to/dist/zoom-vanilla.min.js"></script>
5757
```
5858

59-
3. Add a `data-action="zoom"` attribute to the images you want to make
60-
zoomable:
59+
You can also `import` them if you're using webpack:
6160

62-
```html
63-
<img src="img/blog_post_featured.png" data-action="zoom">
61+
```javascript
62+
import "zoom-vanilla.js/dist/zoom.css"
63+
import "zoom-vanilla.js/dist/zoom-vanilla.min.js"
6464
```
6565

66+
## Usage
67+
68+
Add a `data-action="zoom"` attribute to the images you want to make
69+
zoomable:
70+
71+
```html
72+
<img src="img/blog_post_featured.png" data-action="zoom">
73+
```
74+
6675
## Browser support
6776

6877
zoom-vanilla.js should (in theory) work in all modern browsers. If not, create

0 commit comments

Comments
 (0)