rxgo-widget
v1.0.3
Published
Web component for searching and comparing prices for medicines
Downloads
5
Maintainers
Readme
Rxgo widget
This project includes a sample component using LitElement with JavaScript.
Usage
Install dependencies:
npm i
or add links to CDN
<script type="importmap">
{
"imports": {
"lit": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"rxgo-widget": "https://unpkg.com/[email protected]"
}
}
</script>
Add tag in you markup.
Development
Testing
This sample use modern-web.dev's @web/test-runner for testing. See the modern-web.dev testing documentation for more information.
Editing
If you use VS Code, we highly reccomend the lit-plugin extension, which enables some extremely useful features for lit-html templates:
- Syntax highlighting
- Type-checking
- Code completion
- Hover-over docs
- Jump to definition
- Linting
- Quick Fixes
The project is setup to reccomend lit-plugin to VS Code users if they don't already have it installed.
Linting
Linting of JavaScript files is provided by ESLint. In addition, lit-analyzer is used to type-check and lint lit-html templates with the same engine and rules as lit-plugin.
The rules are mostly the recommended rules from each project, but some have been turned off to make LitElement usage easier. The recommended rules are pretty strict, so you may want to relax them by editing .eslintrc.json
.
Formatting
Prettier is used for code formatting. It has been pre-configured according to the Lit's style. You can change this in .prettierrc.json
.
Prettier has not been configured to run when commiting files, but this can be added with Husky and and pretty-quick
. See the prettier.io site for instructions.
Static Site
This project includes a simple website generated with the eleventy static site generator and the templates and pages in /docs-src
. The site is generated to /docs
and intended to be checked in so that GitHub pages can serve the site from /docs
on the master branch.
To enable the site go to the GitHub settings and change the GitHub Pages "Source" setting to "master branch /docs folder".
The site will usually be served at http://localhost:8000.
Scripts usage
npm start
Run web dev server.
npm run test
Run tests for component against Lit's development mode.
npm test:watch
Run tests for component in Lit's development mode.
npm test:prod
Run tests for component against Lit's production mode.
npm test:prod:watch
Run tests for component in Lit's production mode.
npm run docs
Run doc's static website.
npm run docs:serve
To serve doc's static website locally.
npm run docs:watch
To watch doc's static website files and re-build automatically.
npm run lint
Run project linting.
npm run build
Create build in dist directory based on vite.config.js file .