@pyncho-wc/p-trim-text
v1.0.7
Published
Component that allows to trim text with replacer. And show full text native description on hover
Downloads
5
Readme
<p-trim-text>
Component that allows to trim text with replacer. And show full text with native description (title and aria-label) on hover
This webcomponent follows the open-wc recommendation.
<p-trim-text></p-trim-text>
Installation
CDN
Inside script:
import 'https://cdn.skypack.dev/@pyncho-wc/p-trim-text';
Or in html:
<script
type="module"
src="https://cdn.skypack.dev/@pyncho-wc/p-trim-text">
</script>
With builders like webpack, vite etc:
npm i @pyncho-wc/p-trim-text
If you need to change tag name:
import PTrimText from '@pyncho-wc/p-trim-text/index.js';
customElements.define('custom-trim-text', PTrimText);
Usage
<p-trim-text
letters-to-trim="5"
replacer='---'>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
</p-trim-text>
<!-- RESULT: -->
<!-- Lorem--- -->
Linting and formatting
To scan the project for linting and formatting errors, run
npm run lint
To automatically fix linting and formatting errors, run
npm run format
Testing with Web Test Runner
To execute a single test run:
npm run test
To run the tests in interactive watch mode run:
npm run test:watch
Tooling configs
For most of the tools, the configuration is in the package.json
to minimize the amount of files in your project.
If you customize the configuration a lot, you can consider moving them to individual files.
Local Demo with web-dev-server
npm start
To run a local development server that serves the basic demo located in demo/index.html