I'm wondering when it is useful to use moustache.js (or something similar which do js templating), and when I can use backbone.js (which uses js templating inside it)
I've a web app with multiple pages, a json app, and the pages data are loaded via api calls, so I've tought about using moustache to clean up the rendering, but I'm wondering if backbone will improve something in my case
As already mentioned, they do serve completely difference purposes. Moustache being a templating engine, and Backbone bringing the MVC paradigm to Javascript. To quote from the Backbone homepage
When working on a web application that involves a lot of JavaScript, one of the first things you learn is to stop tying your data to the DOM. It's all too easy to create JavaScript applications that end up as tangled piles of jQuery selectors and callbacks, all trying frantically to keep data in sync between the HTML UI, your JavaScript logic, and the database on your server. For rich client-side applications, a more structured approach is often helpful.
So, if you find yourself writing a load of DOM manipulation calls etc. Or you simply prefer a structured approach to your code - you will find Backbone a godsend.
It is of course possible to use other templating solutions (other than the one bundled with Underscore) and integrate it into a client-side application created with Backbone.
Both cam be use together,
To build web application architecture you can use backbonejs.
and to render templates you can use mustachejs.
First of study basic knowledge about both.
You will well understand when to use what.
Related
I am into this react.js and gatsby.js issue since a while.
But as a senior symfony developer I wonder if there are options
like TWIG even for gatsby sites?
Now I want to create sites with graphQl data and gatsby.
Is templating not possible with this new stack?
React is a JavaScript Library for building user interfaces, according to their website. It simply provides a clever wrapper UI to build component-based building blocks for an app. Once you grab content or/and data from somewhere—e.g. CMS, file system, Graphql DB, etc—you'll have to render them in a format you'd need. You could build a template-like structure via JSX, but I don't think React/Gatsby supports a templating engine like Twig.
If you're looking for a JavaScript-based static site generator, 11ty might be a good alternative, as it supports a whole bunch of templating languages. See this link.
It is not clear to me how to use Polymer for implementing the backend. What is the natural way to process the backend for Polymer? Please show brief sample code to be clear.
As mentioned, Polymer.js is a front end library, specially to provide access to Web Components APIs as they are called.
There is no particular way to make a web request, in fact, though there are elements (iron-ajax) that can help, really you are on your own.
Given that polymer is mostly here to provide early access to Web Component development (and use), personally I decided to use fetch, the coming (low level, at least) standard for AJAX in Javascript.
Here is a link to a polyfill for the fetch API.
https://github.com/github/fetch
IOW: you are on your own making an ajax request, use the Fetch API or some other library of your choosing.
Then you build a RESTful back end and it doesn't matter what sort, though it's common to use Node.js with Express.
We are going to create some applications that will access the same api. We decided that the backed part will be developed in node.js and the database will be MySQL and maybe some parts mongoDB.
I have problem deciding about the front end of the web application that will be a website. Taking a look on this question: Separate REST JSON API server and client? we decided that fits better to us server side templating/rendering.
Do you think that using a PHP framework (like symfony, laravel etc) only for templating is good solution, or is it stupid to use a complete framework that offers a lot of features that we are not going to use only for templating? I was thinking to use twig that is only a template engine and try to fit backbone on it just to structure better the ajax calls to the RESTful API.
Do you have something different to suggest for server side rendering?
I have no experience at all, thats why i am writing to prevent taking bad decisions.
There are a bunch of awesome templating options for Node.JS! Here's a small list of some that I've used:
hogan (by twitter, feels like mustache)
jade (by tjholowaychuk, same code-machine behind express and a bunch of other awesome node projects)
ginger (by yours truly!)
swig (my personal favourite right now)
ejs (simple javascript-in-html thing, feels like php)
I like swig right now. It's basically what I wanted to build when I was working on ginger. It looks and feels a lot like django's templating system, which many popular template languages (twig, for example) have been inspired by.
Currently I have a web site full of static pages. This minimizes web server load and guarantees that this site will run even on tiny Linux-based hardware web server.
I am seeking for an ability to make master pages for my site and I like the way used by Ruby on Rails, but this technology is redundant for a simple web site and is too heavy for a simple hardware web server.
I like the SSI, it is really lightweight and cross-platform, but it does not provide master pages, it only makes includes that each document should maintain by oneself.
I like an AJAX technology, but it is client-side dependent.
The IFRAME technology does the opposite to what I want - it references from master page to slave page, and I need the reverse.
Is there something else left?
Template-Toolkit, specifically the wrapper directive, should do the trick.
You can use ttree at build time to generate static pages, avoiding the need for any server side technology beyond a simple HTTPD.
Em.. php includes?
So: CSS, Javascript, Includes directories detailing reusable styling, client scripting, and markup respectively?
There is no way to get any form of master page in the way that you are talking about without server side scripting I'm afraid. The best you can hope for is a JavaScript file that loads other JavaScript files, and external stylesheets (one unusual method I saw was the creation of a universal stylesheet that imported many others - but I didn't see all that much benefit to organisation myself). You could always use iframes... but iframes, as you point out aren't designed for that sort of functionality. That sort of functionality was within the scope of frames, and that had unpleasant results.
If you want to use something like php your server will naturally have to support php, but it is a simple way to produce easy organisation of your pages without having to dive neck deep into a complicated framework like Rails. In my experience adopting a CMS, particularly that developed by somebody else can be more trouble than it's worth.
i'm here to ask a general question about Extjs or any other web related technologies....
i found out that it is impossible to parse xml without the help of any webservice.....
so i would like to know about the pro's and cons about these kind of technologies specifically sencha.
whats the best feature you find intresting about this technology and also the worst thing...
ExtJS, SmartClient, YUI, MooTools, etc are all rich Internet application (RIA) frameworks that allow you to integrate at the JavaScript and/or Google Web Toolkit levels. I have generally seen ExtJS and SmartClient compared most frequently. I have used SmartClient myself and one reason I did was because of the licensing differences between the two.
The biggest advantage of something like ExtJS or SmartClient is that they allow you to focus on building a data-driven service that easily integrates with their rich set of widgets. This allows you to focus on your data and simply leverage their flexible, cross browser-ish, slick looking web GUI controls.
In my opinion, it's a great time saver and browser robustness advantage. You can combine these with things like JQuery, etc. In fact, you can use ExtJS and SmartClient together if you like. (although most people won't)
There's a data package in ExtJS & Sencha Touch that allows you to easily bind client apps to JSON, YQL, XML datasources.
You should probably take a look at the documentation for the data.* part of the ExtJS library: http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.XmlStore and this area is further improving in the forthcoming EXT JS 4