1.0.7 • Published 2 years ago
@pyncho-wc/p-trim-text v1.0.7
\
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-textIf 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 lintTo automatically fix linting and formatting errors, run
npm run formatTesting with Web Test Runner
To execute a single test run:
npm run testTo run the tests in interactive watch mode run:
npm run test:watchTooling 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 startTo run a local development server that serves the basic demo located in demo/index.html