How to render HTML templates in Pedestal? - clojure

I am going over the Pedestal docs at
https://github.com/pedestal/pedestal/tree/master/guides/documentation
There are no examples for how to render html from templates. Does pedestal even have this functionality? If so, can anyone please explain how this works, with an example...

Pedestal doesn't ship with a template system, but instead relies on third-party libraries. You could check this template-serverexample.
It demonstrates the use of several popular templating libraries :
hiccup
enlive
mustache
stringtemplate
comb
Selmer
But you could use any templating library you want.
Here is an article to help choose one.

Related

RAML2HTML Templates Library

We recently decided to use RAML to document our API and all seems great so far.
We are using the raml2html utility to generate static HTML documentation. The default template works great, but I've seen much better API pages. Does anyone know about some collection of examples/ready-to-use templates?
EDIT: As RAML is evolving, the tools around it are evolving as well. I recently found a very nice theme that might be of interest: https://github.com/wdullaer/raml2html-slate-theme

Is it possible to use ember components declaratively as tags?

I have a lot of experience with AngularJS and I'm also playing around with Web Components and Polymer for a long time now.
What I really love about the these libraries and technologies, is the fact that they let me build my own components.
AngularJS gives me something called "Directives" and Web Components consists of a set of specs where one is called "Custom Elements", which pretty much does how it's called.
So with these I can do something like:
<my-element></my-element>
This is where the web goes, this is what everybody loves about HTML. Declarative tags that are easy to read and encapsulate functionality and behaviour. Also very nice: once Web Components are fully supported in the browsers, I could for example very easily remove my directive and rely on a web component, that looks and works the same without changing any code.
I know, that EmberJS has something called "Ember Components" which lets you basically build your own kind of components too. However, using them in HTML looks something like this:
{{#my-component}}
{{/my-component}}
Is it possible in EmberJS to also use components declaratively as tags?
I actually hate that about html. I hate the structure etc, but that's just my opinion :)
No, there isn't, your component should be declared in a template using the handlebars syntax, and compiled to js. (you can dynamically create views/components, but that's far from declarative tags).
You'll be able to do that when Glimmer 2 ships with Ember. It was supposed to be in with Ember 2.x, but for some reason its still pending. With that you can use angle brackets to define components.
<my-element></my-element>

CSS3 Stylesheet Template

I was looking around and could not find a CSS3 Template to use as a basic starting template. I was wondering if anybody knows if something like this even exists. Basically, I am looking for a basic stylesheet to start off with that includes all of the basic selectors so that I can fill them in or remove if not needed.
Thanks
The Wikipedia article on CSS frameworks has a list of popular frameworks and some useful stats about them.
Have a look to twitter bootstrap : http://twitter.github.com/bootstrap/
or to fundation (because everybody uses bootstrap, and all sites look the same) : http://foundation.zurb.com/
Regards
Mind if I introduce you to Twitter Bootstrap template?
It is a CSS3 template framework.
This is just a suggestion, since it helped me a lot to learn more about CSS3 and at the same time insight to responsive design.
If you decided to go ahead with twitter bootstrap go to this link for more resources.

TYPO3 template library

I'm looking for TYPO3 template libraries. They don't need to be free. I'm looking for real Typo3 templates, ready to import into a vanilla Typo3 installation, not just HTML or even PSD templates.
The reason I'm asking is that we have a number of customers with very tight budget. We'd like to give them a number of templates to choose from.
There were such projects, but I assume that most of them are just finished now. TYPO3 has no default data/content structure and therefore it's hard to build useful sets as every implementation can be very individual.
For your own low-budget production I'd suggest to create some very typical raw implementations with sample data and some kind of preconfigured extensions ie.
CMS+ News + contact form + gallery,
CMS + News + FAQ...
etc...
Then you can also prepare common TypoScript element for each scenario and finally just use any HTML template and map your prepared TS with minimal modifications.
Using TemplaVoila you don't need to change any single char in the HTML templates and it takes no more than 2 morning coffees (when mapping a simple template).
A simple Typo3 template isn't really difficult to make but I think you mean a better browser compatibility support. Personally I've good experience with YAML.
I'm not aware of anything like that out there, but is it just for content sites, or are you looking for sites with more functionality?
Any template can be adapted to TYPO3, you can see here http://webdevelopers.thedemo.ca/ where in the space of about an hour we grabbed a template from http://www.oswd.org/ and turned it into a TYPO3 site. It's rough and messy, but shows the idea.

How do I build reusable JSP snippets in an app

I want to build reusable JSP components for an application that I am building. There are multiple ways to go around this. The ones that I know of include building JSPFragments and then stitching the page the together. But that is not an elegant way of doing it.
I am also trying to get mt head around JSP tag libraries to be able to build reusable components for JSP. I read in multiple places that tag libraries are falling out of favour fast. There are other frameworks like JSF and Freemarker templates by which I can build re-usable components. What do I use to build these components. Is there a preferred and contemporary approach I can follow?
I am not sure if this solve your problem. But anyway, I started to use FreeMarker, which is a really good template engine. It follows strict the MVC principal. These feature might help you to decide whether FreeMarker is good for your needs:
Including strategy. This is what I use to include header and footer template files in my view.
Macros. Maybe you want but write your own directives. Unfortunately I have no experience with that.
Using jsp taglibs with FreeMarker is also possible.
Note that FreeMarker is just a template engine. You can not include java code into html like with jsp.
If the component is simple you can use .tag files. They are easy to write. If it is more complex, use a tag library. It is a working solution used many times.