Skip to content

Commit 9319e77

Browse files
committed
Use autoprefixer for vendor prefixes in CSS
- Closes #28 (github)
1 parent 1fecfcf commit 9319e77

File tree

5 files changed

+45
-17
lines changed

5 files changed

+45
-17
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ will open the image in a new tab instead of zooming it.
2222
2. Add the `zoom-vanilla.min.js` and `zoom.css` files to your HTML page:
2323

2424
```html
25-
<link href="css/zoom.css" rel="stylesheet"> <!-- inside <head> -->
25+
<link href="dist/zoom.css" rel="stylesheet"> <!-- inside <head> -->
2626
<script src="dist/zoom-vanilla.min.js"></script> <!-- before </body> -->
2727
```
2828

@@ -53,6 +53,6 @@ an issue! Thanks!
5353
- `npm i` to install dev dependencies
5454
- `npm start` to start a simple HTTP server (makes it easy to view the demo
5555
page)
56-
- `npm run build` to build the minified JS
57-
- `npm run watch` to rebuild when any files change (recommended for
56+
- `npm run build` to build the minified JS and vendor-prefixed CSS
57+
- `npm run watch` to rebuild when any JS files change (recommended for
5858
development)

css/zoom.css

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
img[data-action="zoom"] {
2-
cursor: pointer;
3-
cursor: -webkit-zoom-in;
4-
cursor: -moz-zoom-in;
2+
cursor: zoom-in;
53
}
64
.zoom-img,
75
.zoom-img-wrap {
86
position: relative;
97
z-index: 666;
10-
-webkit-transition: all 300ms;
11-
-o-transition: all 300ms;
12-
transition: all 300ms;
8+
transition: all 300ms;
139
}
1410
img.zoom-img {
15-
cursor: pointer;
16-
cursor: -webkit-zoom-out;
17-
cursor: -moz-zoom-out;
11+
cursor: zoom-out;
1812
}
1913
.zoom-overlay {
2014
z-index: 420;
@@ -27,9 +21,7 @@ img.zoom-img {
2721
pointer-events: none;
2822
filter: "alpha(opacity=0)";
2923
opacity: 0;
30-
-webkit-transition: opacity 300ms;
31-
-o-transition: opacity 300ms;
32-
transition: opacity 300ms;
24+
transition: opacity 300ms;
3325
}
3426
.zoom-overlay-open .zoom-overlay {
3527
filter: "alpha(opacity=100)";

dist/zoom.css

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}
3434
}
3535
</style>
36-
<link rel="stylesheet" type="text/css" href="css/zoom.css">
36+
<link rel="stylesheet" type="text/css" href="dist/zoom.css">
3737
</head>
3838
<body>
3939
<div class="container">

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@
2020
},
2121
"homepage": "https://github.com/spinningarrow/zoom-vanilla.js",
2222
"devDependencies": {
23+
"autoprefixer": "^6.7.7",
2324
"http-server": "^0.9.0",
25+
"postcss-cli": "^3.0.0",
2426
"uglify-js": "^2.7.3",
2527
"watch": "^0.19.2"
2628
},
2729
"scripts": {
2830
"_echo_done": "echo [`date`] \"\\033[1;32mzoom-vanilla.min.js rebuilt\\033[0m\"",
2931
"compress": "uglifyjs --compress --mangle --source-map=dist/zoom-vanilla.min.js.map --source-map-url='/dist/zoom-vanilla.min.js.map' --source-map-root='/' --preamble=\"// $npm_package_name - $npm_package_version ($npm_package_homepage)\" js/zoom-vanilla.js > dist/zoom-vanilla.min.js",
3032
"clean": "rm -rf dist/*",
31-
"build": "npm run clean && npm run compress",
33+
"build": "npm run clean && npm run compress && npm run css",
34+
"css": "postcss css/zoom.css --use autoprefixer -d dist/",
3235
"start": "http-server",
3336
"version": "npm run build && git add -u .",
3437
"watch": "watch 'npm run compress && npm run _echo_done' js --ignoreDotFiles"

0 commit comments

Comments
 (0)