Difference between WebComponent and lit-html - polymer

Hi am started to looking into the Polymer3 and came to know about the lit-html and i couldn't understand what are the major differences between lit-html and web components? expect the lit-html's html tag. could some one explain more in detail. Thanks in advance.

Those two are not really comparable technologies. Anyway if you want to learn more about them I suggest looking for those pages.
lit-html lets you write HTML templates in JavaScript using template literals with embedded JavaScript expressions. lit-html identifies the static and dynamic parts of your templates so it can efficiently update just the changed portions. Docs
Web Components is a suite of different technologies allowing you to create reusable custom elements — with their functionality encapsulated away from the rest of your code — and utilize them in your web apps. Docs

Related

Will polymer build more ready-use components?

I am going to port our windows-based Customer Management software to Web-based. I find polymer may be a choice.
However, for our usage, we can't find polymer component has table-view, drop-down menu(aka. the "select" element in html), date-picker, tree list.
Will polymer add these components later? Or these components will not be the target?
Thanks,
Barry
Polymer is just primarily a polyfill library that helps enabling HTML 5 Web Components in browsers that don't support them by themselves.
Web Components can be written by any developer, so you might need to develop some controls on your own especially the table view one. I'd guess you'll find most of the others mentioned in your question implemented one way or another. You should check out some of the WebComponents collection pages:
http://customelements.io/
http://component.kitchen/
http://bower.io/search/?q=web-components
For your table view control: I had a similar problem couple of years ago and had to implement my own solution. Maybe you can find a regular HTML library that supports table views and make it a (Polymer) Web Component by yourself.

Using polymer.dart to build portable web components

I'd like to use polymer.dart to build a set of portable web components that can be embedded in any random html page (including pages outside of any dart project). The idea is that a customer could embed my polymer.dart elements on his html pages without the customer needing to create a dart application. I would think this would be an obvious and straightforward thing to do - but after going through many tutorials and instructional pages, and reading through lots of dart/polymer.dart documentation, I haven't found any explanation of how to go about this. Presumably the dart/polymer code would have to be compiled to javascript for inclusion on the customer's html page. Could someone comment on if this is possible, and if so, provide an explanation with examples of how to go about it? This dart/polymer.dart newbie would be grateful for any assistance.
I don't think this will work with Dart.
You need to run pub build over a Dart application to get a deployable result.
I guess this would work better with JavaScript Polymer elements.
There are plans to support this scenario but I guess it will still take a while.

Developing reusable html components

I would like to development a set of HTML components that can be reused across a set of applications developed by many of our business partners (both internal and external do our domain). For example, I would like to develop a 'graph' widget that takes care of all the details around retrieving data, plotting on a chart and so on. Then a business partner can 'reference' this component and embed it within their web application. I logically visualize this as the partner being able to link to the component and the component returns with all the details in between. Traditional ways of doing this leveraged IFrames but we do not want to utilize this approach for internal reason.
Are there existing frameworks that allow that allow this?
I'm aware of all the XSS and it seems it's possible to do if I leverage CORS. Are there other security (or other aspects) I need to be aware of?
To simply the question, is there a way a client can make an http call out to my service, and my service returns HTML fragment (including whatever required css/js needed to render the html).
Thanks in advance.
With pure HTML, this is not possible; HTML is simply a markup language, and is not extensible.
However, XHTML is extensible (see: Developing DTDs with defined and extended modules).
You could also utilize CSS and/or JavaScript files (which your business partner could reference with <link> and <script> elements, respectively), which could modify the appearance (CSS) and behavior (JS) of normal HTML. There are a number of libraries using these techniques already which you could potentially use. For example, Kendo can transform your "normal" HTML elements into something feature-rich.

HTML Layout/Templating

I am building a website where i'm looking to create html templates which contain placeholders where i'll be able to inject pages/content, menus, etc.... I really like AngularJS which has good support for this but am thinking that it might be a bit of an overkill for what i'm building. There is a chance some parts of the application will eventually be ripped out and run standalone and so dont want to tie the html/javascript to a library which requires so much framework specific syntax. Are there any other, simpler libraries, that will allow me to do this? thanks in advance
/Eric
KnockoutJS is pretty lightweight and also includes a templating feature.
I wouldn't just dismiss angularjs because it seems like a heavy framework. There are very simple ways to use it without using any of the "advanced" features like routing, creating services, creating directives, etc. You can simply have a controller and use the built in directives to do a lot of powerful things on a single page. Angular is also pretty small and is easily bootstrapped with the ng-app tag anywhere in your DOM.

Does Django have HTML helpers?

Does Django have any template tags to generate common HTML markup? For example, I know that I can get a url using
{% url mapper.views.foo %}
But that only gives me the URL and not the HTML code to create the link. Does Django have anything similar to Rails' link_to helper? I found django-helpers but since this is a common thing I thought Django would have something built-in.
No it doesn't.
James Bennett answered a similar question a while back, regarding Rails' built-in JavaScript helpers.
It's really unlikely that Django will ever have 'helper' functionality built-in. The reason, if I understand correctly, has to do with Django's core philosophy of keeping things loosely coupled. Having that kind of helper functionality built-in leads to coupling Django with a specific JavaScript library or (in your case) html document type.
EG. What happens if/when HTML 5 is finally implemented and Django is generating HTML 4 or XHTML markup?
Having said that, Django's template framework is really flexible, and it wouldn't be terribly difficult to write your own tags/filters that did what you wanted. I'm mostly a designer myself, and I've been able to put together a couple custom tags that worked like a charm.
The purpose of helpers is not, as others here imply, to help developers who don't know how to write HTML. The purpose is to encapsulate common functionality -- so you don't need to write the same thing a thousand times -- and to provide a single place to edit common HTML used throughout your app.
It's the same reason templates and SSI are useful -- not because people don't know how to write the HTML in their headers and footers, but sometimes you want to write it just once.
EG. What happens if/when HTML 5 is
finally implemented and Django is
generating HTML 4 or XHTML markup?
Same thing that happens when HTML 5 is implemented and all your templates are written in repetitive HTML, except a lot easier.
The other posts have already answered the question, linking to the docs on custom template tags; you can use tags and filters to build your own, but no, there aren't any built in.
it doesnt look like they're built in but here's a couple snippets. it looks like it'd be pretty easy to create these helpers:
http://www.djangosnippets.org/snippets/441/
Here is a list of all template tags and filters built into Django. Django core doesn't have as much HTML helpers as Rails, because Django contributors assumed that web developer knows HTML very well. As stated by saturdaypalace, it's very unlikely for AJAX helpers to be added to Django, because it would lead to coupling Django with a specific JavaScript library.
It's very easy to write your own template tags in Django (often you need just to define one function, similiar to Rails). You could reimplement most of Rails helpers in Django during a day or two.
I bet if there would be any consent of what is common html, there would be helpers module too, just for completeness (or because others have it). ;)
Other than that, Django template system is made mostly for HTML people, who already know how to write p, img and a tags and do not need any helpers for that. On the other side there are Python developers, who write code and do not care if the variable they put in context is enclosed by div or by span (perfect example of separation of concerns paradigm). If you need to have these two worlds to be joined, you have do to it by yourself (or look for other's code).
This won't answer directly to the question, but why not using foo in template then?