Skip to content

Commit

Permalink
bundle recommended CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
clementroche committed Jul 26, 2024
1 parent a427107 commit 837b133
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function raf(time) {
requestAnimationFrame(raf)
```

Add the following CSS to your project:
#### Recommended CSS:

```css
html.lenis, html.lenis body {
Expand All @@ -94,6 +94,18 @@ html.lenis, html.lenis body {
}
```

or link the CSS file:

```html
<link rel="stylesheet" href="https://unpkg.com/lenis@1.1.5/dist/lenis.css">
```

or import it:

```js
import 'lenis/dist/lenis.css'
```

### GSAP ScrollTrigger:
```js
const lenis = new Lenis()
Expand Down
20 changes: 20 additions & 0 deletions dist/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
html.lenis,
html.lenis body {
height: auto;
}

.lenis.lenis-smooth {
scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
overscroll-behavior: contain;
}

.lenis.lenis-stopped {
overflow: hidden;
}

.lenis.lenis-smooth iframe {
pointer-events: none;
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lenis",
"scripts": {
"build": "rollup --bundleConfigAsCjs -c",
"postbuild": "shx rm -rf ./dist/types/ && shx cp -r ./dist/* ../../dist",
"postbuild": "shx rm -rf ./dist/types/ && shx cp -r ./src/style.css ./dist && shx cp -r ./dist/* ../../dist",
"dev": "npm-run-all --parallel watch playground",
"watch": "rollup --bundleConfigAsCjs -c -w",
"playground": "npm run dev --prefix ./playground"
Expand Down
20 changes: 20 additions & 0 deletions packages/core/src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
html.lenis,
html.lenis body {
height: auto;
}

.lenis.lenis-smooth {
scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
overscroll-behavior: contain;
}

.lenis.lenis-stopped {
overflow: hidden;
}

.lenis.lenis-smooth iframe {
pointer-events: none;
}

0 comments on commit 837b133

Please sign in to comment.