-
Notifications
You must be signed in to change notification settings - Fork 318
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
Comments
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? |
I've started writing down examples / best practices here: https://github.com/LarsDenBakker/lit-html-examples. Perhaps that can be a starting point. |
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).
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. |
This blog post has some really useful info: https://43081j.com/2018/08/future-of-polymer |
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. |
@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. |
I think this issue is a bit broad and vague to be actionable. We can add issues for specific guidance as it comes up. |
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.
The text was updated successfully, but these errors were encountered: