Subtext 2.5 Skin Improvements

Deploying a Subtext skin used to be one of the biggest annoyances with Subtext prior to version 2.5. The main problem was that you couldn’t simply copy a skin folder into the Skins directory and just have it work because the configuration for a given skin is centrally located in the Skins.config file.

elephant-skinIn other words, a skin wasn’t self contained in a single folder. With Subtext 2.5, this has changed. Skins are fully self contained and there is no longer a need for a central configuration file for skins.

What this means for you is that it is now way easier to share skins. When you get a skin folder, you just drop it into the /skins directory and you’re done!

In most cases, there’s no need for any configuration file whatsoever. If your skin contains a CSS stylesheet named style.css, that stylesheet is automatically picked up. Also, with Subtext 2.5, you can provide a thumbnail for your skin by adding a file named SkinIcon.png into your skin folder. That’ll show up in the improved Skin picker.

When To Use A Skin.config File

Each skin can have its own manifest file named Skin.config. This file is useful when you have multiple CSS and JavaScript files you’d like to include other than style.css (though even in this case it’s not absolutely necessary as you can reference the stylesheets in PageTemplate.ascx directly).

The other benefit of using the skin.config file to reference your stylesheets and script files is you can take advantage of our ability to merge these files together at runtime using the StyleMergeMode and ScriptMergeMode attributes.

Also, in some cases, a skin can have multiple themes differentiated by stylesheet as described in this blog post. A skin.config file can be used to specify these skin themes and their associated CSS file.

Creating a Skin.config file

Creating a skin.config file shouldn’t be too difficult. If you already have a Skins.User.config file, it’s a matter of copying the section of that file that pertains to your skin into a skin.config file within your skin folder and removing some extraneous nodes.

Here’s an example of a new skin.config file for my personal skin.

<?xml version="1.0" encoding="utf-8" ?>
<SkinTemplates>
    <SkinTemplate Name="Haacked-3.0">
        <Scripts>
            <Script Src="~/scripts/lightbox.js" />
            <Script Src="~/scripts/XFNHighlighter.js" />
        </Scripts>
        <Styles>
            <Style href="~/css/lightbox.css" />
            <Style href="~/skins/_System/csharp.css" />
            <Style href="~/skins/_System/commonstyle.css" />
            <Style href="~/skins/_System/commonlayout.css" />
            <Style href="~/scripts/XFNHighlighter.css" />
            <Style href="IEPatches.css" conditional="if IE" />
        </Styles>
    </SkinTemplate>
</SkinTemplates>

If you compare it to the old format, you’ll notice the <Skins> element is gone and there’s no need to specify the TemplateFolder since it’s assumed the folder containing this file is the template folder.

Hopefully soon, we’ll provide more comprehensive documentation on our wiki so you don’t have to go hunting around my blog for information on how to skin your blog. My advice is to copy an existing skin and just tweak it.

What others have said

Requesting Gravatar... Adam Jun 06, 2010 3:27 PM
# re: Subtext 2.5 Skin Improvements
Phil,

It looks like you have a missing tag or something, because your fonts go back to courier new after the text Skins.User.config file for you home page.

Cheers,
Adam
Requesting Gravatar... Adam Jun 06, 2010 3:29 PM
# re: Subtext 2.5 Skin Improvements
Looks like its a rogue block looking at your source.
Requesting Gravatar... haacked Jun 07, 2010 12:23 AM
# re: Subtext 2.5 Skin Improvements
@Adam thanks. I fixed it.
Requesting Gravatar... Bradley Landis Jun 09, 2010 12:35 AM
# re: Subtext 2.5 Skin Improvements
What is the best way to work with the project while developing skins? I installed Subtext, created a blog, copied an existing skin to a new directory and updated the skin.config. Then I made a few changes to the page template and selected the new skin. Everything worked great. But now when I make more changes, no matter what I do, I can't get the changes to take effect. Does it have to do with the pre-compilation?
Requesting Gravatar... haacked Jun 09, 2010 3:48 AM
# re: Subtext 2.5 Skin Improvements
@Bradley, that probably has to do with caching. Try making a change to web.config (like adding a space somewhere) and save the file. Then refresh your website.
Requesting Gravatar... Bradley Landis Jun 09, 2010 10:19 PM
# re: Subtext 2.5 Skin Improvements
Phil,

Thanks. It turned out to be something very simple. The skin that I copied had files in its Control folder called _Header.ascx and Header.ascx. I was editing the wrong the one.
Requesting Gravatar... raffaeu Jun 19, 2010 1:20 AM
# re: Subtext 2.5 Skin Improvements
Hi Phil, I just migrated my blog from 2.1 to 2.5.
It's working now but there are plenty of bugs in the migration process and now the configure section raises unhandled exceptions.
Where I can post these errors in order to help you?
Great job, anyway, it's seems really faster than before!
Requesting Gravatar... haacked Jun 20, 2010 2:36 AM
# re: Subtext 2.5 Skin Improvements
@raffaeu Please post them to http://code.google.com/p/subtext. Thanks!!!
Requesting Gravatar... raffaeu Jun 20, 2010 10:18 AM
# re: Subtext 2.5 Skin Improvements
I will Phil. Sorry about the late for the MAC skin but as you may noticed WH4L just ruined my life in the latest 2 weeks as they wiped everything. Fortunately SubText is very easy to restore if you keep the backup of SQL.
Requesting Gravatar... Herts Jan 18, 2011 1:22 AM
# re: Subtext 2.5 Skin Improvements
We must remember that viagra take the juice before cialis under identical conditions viagra so you can keep each other
Requesting Gravatar... Pes Patch Mar 16, 2011 7:40 AM
# re: Subtext 2.5 Skin Improvements
Nice article.Thank you Phil
Requesting Gravatar... vCloud Apr 03, 2011 9:20 AM
# re: Subtext 2.5 Skin Improvements
Really great information for the subtext user as there was a lot of problem before the release of this version. The application .config file looks useful to everyone and explanation given by you for creating config files is easily understandable. I hope we will be soon come across lot of update on this version on your wiki. I definitely follow your advice. Thanks for sharing this information with use which will be useful for us to large extent.
Requesting Gravatar... Pes 2012 May 07, 2011 6:35 AM
# re: Subtext 2.5 Skin Improvements
Its ver useful tips for improvement
Requesting Gravatar... vBulletin services May 09, 2011 11:27 AM
# re: Subtext 2.5 Skin Improvements
This is always a good idea to have a style sheet rather then just placing the whole source code in web page, that make Google bot very hard to even find good content on a page. Meta keywords and description is still very important. Rather then just having the js file if i use a open source js file would that even work?
Requesting Gravatar... ATL Escorts Oct 14, 2011 9:28 PM
# re: Subtext 2.5 Skin Improvements

This is strange thing.Your observation is fine from one corner if we see things.Lots of people do have this view but things are like that.
Requesting Gravatar... Harry Dec 17, 2011 8:10 PM
# re: Subtext 2.5 Skin Improvements
The application .config file looks useful to everyone and explanation given by you for creating config files is easily understandable. I hope we will be soon come across lot of update on this version on your wiki.
Requesting Gravatar... Wojtek Jan 28, 2012 1:41 PM
# re: Subtext 2.5 Skin Improvements
Hi Phil, thanx for your artile, very usefull :)
Requesting Gravatar... Imobiliarias em Sao Paulo Mar 28, 2012 12:03 AM
# re: Subtext 2.5 Skin Improvements
The application .config file looks useful to everyone and explanation given by you for creating config files is easily understandable. Thanks!

What do you have to say?

(will show your gravatar)
Please add 2 and 3 and type the answer here: