# Add a New Lit Project The code for this example is available on GitHub: {% github-repository url="https://github.com/nrwl/nx-recipes/tree/main/lit" /%} **Supported Features** Because we are not using an Nx plugin for Lit, there are few items we'll have to configure manually. We'll have to configure our own build system. There are no pre-created Lit-specific code generators. And we'll have to take care of updating any framework dependencies as needed. {% pill url="/features/run-tasks" %}✅ Run Tasks{% /pill %} {% pill url="/features/cache-task-results" %}✅ Cache Task Results{% /pill %} {% pill url="/ci/features/remote-cache" %}✅ Share Your Cache{% /pill %} {% pill url="/features/explore-graph" %}✅ Explore the Graph{% /pill %} {% pill url="/ci/features/distribute-task-execution" %}✅ Distribute Task Execution{% /pill %} {% pill url="/getting-started/editor-setup" %}✅ Integrate with Editors{% /pill %} {% pill url="/features/automate-updating-dependencies" %}✅ Automate Updating Nx{% /pill %} {% pill url="/features/enforce-module-boundaries" %}✅ Enforce Module Boundaries{% /pill %} {% pill url="/features/generate-code" %}🚫 Use Code Generators{% /pill %} {% pill url="/features/automate-updating-dependencies" %}🚫 Automate Updating Framework Dependencies{% /pill %} ## Install Lit and Other Dependencies Install all the dependencies we need: {% tabs %} {%tab label="npm"%} ```shell {% skipRescope=true %} nx add @nx/node npm add -D lit http-server ``` {% /tab %} {%tab label="yarn"%} ```shell {% skipRescope=true %} nx add @nx/node yarn add -D lit http-server ``` {% /tab %} {%tab label="pnpm"%} ```shell {% skipRescope=true %} nx add @nx/node pnpm add -D lit http-server ``` {% /tab %} {% /tabs %} ## Create an Application {% callout type="note" title="Directory Flag Behavior Changes" %} The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details. {% /callout %} We'll start with a node application and then tweak the settings to match what we need. Add a new node application to your workspace with the following command: ```shell nx g @nx/node:app my-lit-app --directory=apps/my-lit-app ``` Choose `none` for the node framework, since we won't be using this as a node app. ### Turn the Application into a Lit Application Update `main.ts`: ```typescript {% fileName="apps/my-lit-app/src/main.ts" %} import { LitElement, html } from 'lit'; import { customElement, property } from 'lit/decorators.js'; @customElement('my-element') export class MyElement extends LitElement { @property() version = 'STARTING'; render() { return html`
Welcome to the Lit tutorial!
This is the ${this.version} code.
`; } } ``` Create `index.html`: ```html {% fileName="apps/my-lit-app/index.html" %}Welcome to the Lit tutorial!
This is the ${this.version} code.
Imported from a library: ${someFunction()}.
`; } } ``` Now when you serve your application, you'll see the content from the library being displayed. ## More Documentation - [@nx/esbuild](/nx-api/esbuild) - [@nx/js](/nx-api/js) - [Lit](https://lit.dev/)