Open mischnic opened 3 years ago
https://parceljs.org/blog/rc0/#worklet-support
For example, this works with Parcel 2 (the URL constructor call has to happen in the addModule argument, and the filepath has to be a string literal):
addModule
<!DOCTYPE html> <html> <head> <title></title> <style> .demo { --border-radius-reverse: 10; --border-radius-reverse-color: orange; border: calc(var(--border-radius-reverse) * 1px) solid transparent; border-image: paint(border-radius-reverse); border-image-slice: var(--border-radius-reverse); width: 100px; height: 100px; } </style> </head> <body> <div class="demo"></div> <script type="module"> CSS.paintWorklet.addModule( new URL( "npm:@houdini-modules/border-radius-reverse", import.meta.url ) ); </script> </body> </html>
Unrelated to that, I find the /worklet.js suffix a bit misleading, because for example @houdini-modules/border-radius-reverse doesn't contain such a file.
/worklet.js
@houdini-modules/border-radius-reverse
https://parceljs.org/blog/rc0/#worklet-support
For example, this works with Parcel 2 (the URL constructor call has to happen in the
addModule
argument, and the filepath has to be a string literal):Unrelated to that, I find the
/worklet.js
suffix a bit misleading, because for example@houdini-modules/border-radius-reverse
doesn't contain such a file.