0.1.2 • Published 6 years ago
v-splitter v0.1.2
v-splitter
Inspired by the library Splitting JS and the easy animation it provides as shown in this Courstro video.
The VSplitter component takes just one "prop" called text and will split (into <span>s) the passed text into words, characters and spaces. In addition it provides the following css variables that might be useful for css styling:
--word-index: index of the <span> of the word
--char-index: index of the character within the given word
--abs-index: index of the character across all wordsas well as classes:
v-splitter__word: <span> containing a word
v-splitter__char: <span> containing a char
v-splitter__space: <span> containing a space (also has 'char')The solution to the dynamic CSS variables was figured out via this post.
Splitting JS: https://splitting.js.org/
Project setup
npm installCompiles and hot-reloads for development
npm run serveCompiles and minifies for production
npm run buildRun your tests
npm run testLints and fixes files
npm run lintRun your unit tests
npm run test:unit