How vueuse/sound works
Project type and purpose
• This is an open-source Vue composable library (“@vueuse/sound”) that wraps Howler.js to provide reactive sound utilities for Vue 2/3 and Nuxt 2/3.
• It also includes a live demo site (in the demo folder) built with Nuxt to showcase features (play, hover, sprites, pitch, etc.).
File structure
• Top-level:
• src/ → core library code (TypeScript)
• src/nuxt/ → Nuxt module integration (module.ts, runtime plugins, composables)
• build.config.ts → rollup/Vite build configuration for bundling the package
• demo/ → standalone Nuxt project demonstrating usage
• docs/ → markdown documentation and images
• package.json, tsconfig.json, eslint.config.js, netlify.toml → configuration, dependencies, CI/CD
• Patterns:
• Composable pattern (Vue Composition API)
• Plugin/module pattern (Nuxt integration)
• Lazy loading of Howler.js for performance
Key insights from README
• Core API: useSound(url, options) returns play + exposedData (stop, pause, isPlaying, etc.)
• Delegates unknown options to Howler’s Howl constructor (escape hatch)
• Supports sprites, reactive options, force-loading on interaction
• Demo is hosted via Netlify, plugin auto-scans sounds in public/sounds