Managing Themes with Spring MVC - spring

I am working on a dating site. The website will have multiple front end themes. I want to follow good practice when setting up the structure of the project. I have posted an image of how the structure will look like. Multiple front end themes in the themes folder containing all the images, css, etc related to that theme in the folder.
Am I on the right track here? How can I tell Spring which theme I want loaded?

Use Sitemesh to change theme depends on your URL pattern
http://codesilo.wordpress.com/2013/07/11/spring-mvc-with-sitemesh-3/

Related

What's the best way to have two themes on a single Grav CMS site?

I can easily switch between themes, but it rewrites the entire site, can I assign a theme to a page? In that way I can have multiple themes
there is great plugin named Themer that enables you use different themes on one site individual set per page or collection
here's the github link : https://github.com/sommerregen/grav-plugin-themer
Maybe a start to your issue

Is it possible to use w3.css with Vaadin?

I just have learned about vaadin and I'm watching tutorial about a CRUD TODO list in youtube. Vaadin uses Valo theme for css rendering that I found great but I'm wondering is it possible to use w3.css framework within vaadin vue code ?
I try googling but no answers.
It depends™
If you are asking: can is just replace Valo with W3.css the answer is most likely no, at least out of the box. The reason for this is, that Vaadin client side code emits the HTML-code you see in the browser and all style and class tags there are defined on their end. So what any theme for Vaadin must do, is to provide styling rules for that exact schema; so you would have to find a way to adapt. Or you have to put addStyleName all over your code (if it's btn in your CSS framework, it's v-button in Vaadin and also nested elements might be different etc).
Yet, if you just want to use the styles for some parts of your application (let's say, you want a fancy start page or add cards etc), then you can add the other CSS and use them together. Vaadin/Valo does a good job in isolating their styles from the rest of the page and also within their hierarchy (the theme name is a prefix to all Valo rules). Yet if the two themes then look great together is another story, but Valo itself allows for quite some tweaking just with variables put in SASS.

Custom landing page with Octopress

I've setup Octopress and want to use totally custom styling basically throwing out most of the standard styling that applies to the rest of the site.
I do want to keep reference to all responsive goodness though that is baked in.
What's the best way to setup my custom landing page?
You mean like this?
http://eduncan911.com
^- My Octopress site.
Blog is at: http://eduncan911.com/blog
Since Octopress uses Jekyll under the skin, it would be better to think about how to accomplish this in terms of Jekyll - and there are many ways to do this.
OT: Personally, I find Octopress' theme layout, includes and customs far too complex and too granular. They did this to make it highly customable; but in my view, it tightly couples every template to another template.
Now with that said, there are multiple ways to achieve this. I did answer a very similar question here:
Creating an octopress theme from a wordpress theme
It's Jekyll: therefore, just go create the page however you want it. Replace the /source/index.html with whatever design, html and css you want.
If you don't want the blog roll, or want to move the "blog to another directory", just move the current /source/index.html to, say, /source/blog/index.html. That's it.
As I noted in the answer above, the only import thing is to keep the YAML frontmatter and specify the "layout" as you want to use. For example, I have a layout called "homepage" that is far different than any other layout. My /source/index.html uses layout: homepage.
But even then, you don't even have to use the YAML - create your own raw html file as you see fit. It will be used when you rake generate. This is what I personally did at first. Then, I slowly split up the homepage into the /source/_layouts/homepage.html and just went from there. I did not follow Octopress' entire theme at all - just enough to use posts and pages.

Embedding a theme within a Vaadin portlet

How can I embed a theme within a Vaadin portlet ?
I created a theme as described here but at runtime, when I check the HTML source with Firebug, the theme's style returns a 404 error.
How can I include a theme in my portlet correctly ?
Regards.
In Liferay, Vaadin themes must locate a folder under the portal context. For example, Liferay bundled with Tomcat, the default location is:
LIFERAY_HOME/tomcat-6.0.29/webapps/ROOT/html/VAADIN/themes
For more information take a loot at Book of Vaadin, Section 12.5.
Henri Kerola's answer is correct but leaves out a very irritating pitfall. Your next question on stack overflow will likely be: Why isn't my CSS updating even though I put my new theme in
<LIFERAY_HOME>/<TOMCAT_HOME>/webapps/ROOT/html/VAADIN/themes
It's important to know that Liferay 6.1 Caches css from themes in
<TOMCAT_FOLDER>/temp/liferay/css/portal/html/VAADIN/themes/<THEME_NAME>/styles.css_E_DATA
So if you want to change the theme in a deployed instance you need to delete the cached version, otherwise you will spend hours and hours playing with firebug and fiddler and other tools trying to figure out why you are getting the old theme.
Edit: You can also put liferay in developer mode which prevents the caching, which is even better... just pass this in to the java process running your liferay
-Dexternal-properties=portal-developer.properties

Creating a MVC 3 Site theme design

I have a MVC 3 web application for which I would like to implement a theme/templating framework (similar to Wordpress or Joomla where you can enable or disable different themes for a site) and would like to find out what is the best way to accomplish this.
My design constraints are this. I buy HTML templates from places like Themeforest or Template Monster and want to make a number of these templates available for use in my web app. The templates you typically buy online all have very different CSS layout frameworks, so it's not possible to just drop a new CSS in your /Content/Themes/ folder and then your views work with this because you also have to make changes to the HTML in the Views. So for every new theme in /Content/Themes I also need a new set of /Views/ folders where the HTML is updated to use the proper CSS classes for that theme.
I know in an ideal world I should just have all the CSS compatible with my html views (ie theme switching is purely based on loading a new CSS), but in this case that is just not possible.
So I'm wondering if there is way to tell MVC where the current default Views folder is? A possible project structure I'm thinking of is something like this:
/Themes/Theme1/Views/(all cshtml view pages for this theme goes here)
/Themes/Theme2/Views/(etc)
I know that I can force the views like this
return View("~/Themes/Theme1/Views/Controller/Index.cshtml")
which can be extended to dynamically determine the theme folder with something like this
return View(currentThemeFolder + "/Views/Controller/Index.cshtml")
but I am wondering if there is a better way to do this? Is there someway perhaps in the global.asax to set the default "Views" folder so that the above is not necessary? There must be an entry point to the views because how do you then specify which _viewstart.cshtml file is called? And if I do go for the above design of forcing/"semi-hard-coding" the views what are the down sides to it?
I also want to say that I have not looked much at Areas in MVC 3 and I don't think that would work here, because my understanding is that it would affect your routing, and would also duplicate your model and controllers folders which I don't want. I have on central Model and Controllers folders, but just need multiple Views folders.
You can extend VirtualPathProviderViewEngine to create your own themeable view engine. Here is how: http://www.singingeels.com/Articles/Creating_a_Custom_View_Engine_in_ASPNET_MVC.aspx

Resources