Start a new project using LitElement with everything you need such as router, redux, webpack, linting, etc.
In order to start a new project using this boilerplate you just need to download it from GitHub and modify the project name in the package.json
$ git clone https://github.com/albertopumar/lit-element-boilerplate.git
$ npm install
$ npm start
In order to connect your component to redux this project is using lit-element-redux. To get it working you will need to follow this steps:
import { createStore } from 'lit-element-redux';
createStore(reducer, initialState, enhancers);
import { LitElement, html } from 'lit-element';
import { connect } from 'lit-element-redux';
export class MyComponent extends LitElement { ... }
const ConnectedComponent = connect(mapStateToProps, mapDispatchToProps)(MyComponent);
customElements.define('my-connected-component', ConnectedComponent);
For more information about the package you can access to the repo.
To organize your redux code and keep it near the connected component this project is using Redux Duck structure with queries and operators.
To implement the router in a SPA way, this project is using Vaadin Router. It is a very simple and lightweight router. You can find more info on his repo.
To access all the advantages of having the styles on a CSS file this project compiles the styles inside css files into JavaScript. You can also take advantage of CSS pre-processors like SASS or SCSS.
import styles from './my-component.scss';
export class MyComponent extends LitElement {
...
static get styles() {
return styles;
}
...
}