francoischalifour / medium-zoom

🔎🖼 A JavaScript library for zooming images like Medium
https://medium-zoom.francoischalifour.com
MIT License
3.58k stars 160 forks source link

feat: pure version of separating js and css #204

Closed Nomango closed 7 months ago

Nomango commented 8 months ago

Summary

As discussed in #203, provide a JS bundle without CSS injection and a separate CSS file.

fix #203.

Result

Add two outputs for rollup, generating the following files.

$ tree ./dist                                                          
 ./dist
 ├── medium-zoom.d.ts
 ├── medium-zoom.esm.js
 ├── medium-zoom.js
 ├── medium-zoom.min.js
+└── pure
+   ├── index.d.ts
+   ├── index.js
+   └── style.css

1 directory, 7 files

Usage:

// import pure js files
import mediumZoom from "medium-zoom/dist/pure";

// import pure style files
import "medium-zoom/dist/pure/style.css";

!!! Tested in Astro only. !!!

codesandbox-ci[bot] commented 8 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 54c1f65e150136719f7ae6da6e22dedc43a82637:

Sandbox Source
@medium-zoom/vanilla-example Configuration
@medium-zoom/vanilla-example Issue #203
francoischalifour commented 8 months ago

Thanks so much for handling this @Nomango. I'll review this in the next days.

francoischalifour commented 7 months ago

Changing the base branch to apply further changes to this PR.