Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] best practices #37

Closed
sorvell opened this issue May 1, 2018 · 7 comments
Closed

[docs] best practices #37

sorvell opened this issue May 1, 2018 · 7 comments

Comments

@sorvell
Copy link
Member

sorvell commented May 1, 2018

We get a lot of questions about how elements should be constructed using LitElement and where and how to do various things.

We want to add a best practices document to the wiki here to address some of these questions and put forward some guidance about patterns to use.

@cacophobe
Copy link

cacophobe commented May 13, 2018

Would really appreciate some help/documentation regarding setup, especially from a beginner's perspective and independent of polymer-cli.

Since Polymer seems to be embracing the larger Node ecosystem, it would probably make sense to have some instructions on how to configure WebPack/Babel to be able to use this.

Couldn't get polymer-cli to work in my case, which brought the lack of documentation on alternatives to my attention. It's really difficult for a beginner to start debugging polymer-cli just to able to start using Web Components.

Also, since Lit-Element is now recommended for new projects by the team, it's seems likely that those who want to start learning Polymer/Web Components now, will start here.

If #UseThePlatform is the goal, decoupling this from polymer-cli would help those who want to use the minimum amount of extraneous tools/frameworks in order to embrace the future.

Isn't that why anybody would want to learn Polymer/Lit-Element in the first place?

@LarsDenBakker
Copy link
Contributor

LarsDenBakker commented May 27, 2018

I've started writing down examples / best practices here: https://github.com/LarsDenBakker/lit-html-examples. Perhaps that can be a starting point.

@valpackett
Copy link

valpackett commented Jul 6, 2018

Since immutable data is pretty much necessary to do anything in lit-element, I'd suggest making immer an official (?) recommendation — it's a very lightweight alternative to Redux. It's easy to use for anyone used to mutable data and it is published as an ES Module unlike some other solutions (e.g. freezer).

Couldn't get polymer-cli to work in my case, which brought the lack of documentation on alternatives to my attention

Yeah, I couldn't find any alternatives (well, non-bundling ones — everyone in the react/etc. world seems to be using webpack dev server and such), so I made my own lightweight alternative recently: es-module-devserver. It's a middleware that serves static files and resolves npm-style imports in JavaScript files. Only resolves imports, nothing more. And it uses regular expressions, so you don't have to drag in a whole JS parser as a dev dependency.

@web-padawan
Copy link
Contributor

This blog post has some really useful info: https://43081j.com/2018/08/future-of-polymer

@EpicButterz
Copy link

I agree with @cacophobe about decoupling from the polymer-cli. I was really surprised when I learned that I was basically forced to use it. One of my main expectations from lit-element was that I could rid myself of complicated build processes. I understand that using the polymer-cli isn't all that complicated but it was a hurdle to get over and it doesn't seem right to be dependent on it. Honestly, I am just fine with relative paths to node_modules as long as it eliminates build steps.

@valpackett
Copy link

@EpicButterz please read my comment above — I don't use polymer-cli, I built a very tiny dev server that converts node_modules path. Alternatively, you can use a webpack/rollup server if you're not looking for the '100% no build' experience.

@ghost ghost self-assigned this Dec 13, 2018
@ghost ghost changed the title Add best practices document [docs] best practices Dec 13, 2018
@ghost ghost added the Severity: Medium label Jan 8, 2019
@ghost ghost removed their assignment Feb 26, 2019
@justinfagnani
Copy link
Contributor

I think this issue is a bit broad and vague to be actionable. We can add issues for specific guidance as it comes up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants