An Eleventy environment for creating CSS Houdini Paint worklets.
The 11ty CSS Houdini Worklet Generator is a tool created by Stephanie Eckles. It is designed to help developers quickly set up and test CSS Houdini worklets using the Eleventy static site generator as the server environment. The tool includes a simple worklet that can be viewed in a CodePen demo, and provides instructions on how to include the required polyfill and modify the worklet’s display attributes via CSS custom properties.
npm start that launches Eleventy in watch mode with hot reload provided by Browsersync, making the development process efficient and convenient.To use the 11ty CSS Houdini Worklet Generator, follow these steps:
src directory:_includes/base.njk: A simple HTML5 template that includes the polyfill for CSS Houdini Paint API and the CSS.paintWorklet.addModule pointing to the worklet’s location on the local server.css/style.css: The local server styles file where you will add your worklet to your test elements.index.md: The file that produces the index content, which can be swapped to another one of 11ty’s supported templating languages.worklet.js: The critical file that creates and registers your worklet class.npm start to launch Eleventy in watch mode, which includes a localhost server with hot reload provided by Browsersync.To publish and use your worklet, follow these steps:
npm publish within your local project to publish your worklet as an npm package.bump command to increment your package number, ex: npm run bump patch, if you make any changes to your worklet.The 11ty CSS Houdini Worklet Generator is a useful tool for developers looking to create and test CSS Houdini worklets. By leveraging the Eleventy static site generator, the generator provides an efficient way to set up and develop worklets without the need for complex server environments. With its customizable project structure and development workflow, developers can easily organize and iterate on their worklet projects. The generator also offers guidance on publishing and using worklets as npm packages, making it easy to share and include worklets in other projects.