<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>existdissolve.com &#187; Mobile</title>
	<atom:link href="http://existdissolve.com/category/mobile/feed/" rel="self" type="application/rss+xml" />
	<link>http://existdissolve.com</link>
	<description>the singularity of being and nothingness</description>
	<lastBuildDate>Wed, 16 May 2012 12:54:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Sencha Touch Theming: 1.1.0</title>
		<link>http://existdissolve.com/2011/04/sencha-touch-theming-1-1-0/</link>
		<comments>http://existdissolve.com/2011/04/sencha-touch-theming-1-1-0/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 05:05:01 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Sencha Touch]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2087</guid>
		<description><![CDATA[In my last article, I showed how to get setup and started with creating custom stylesheets. After a significant release (1.1.0) and several reader requests, I&#8217;m updating the walkthrough with screenshots and instructions for v1.1.0. This version will be strictly business: for discussion about the more interesting points of what&#8217;s going on, refer back to&#8230;]]></description>
			<content:encoded><![CDATA[<p>In my last article, I showed how to <a href="http://existdissolve.com/2011/03/sencha-touch-theming-getting-started/">get setup and started with creating custom stylesheets</a>. After a significant release (1.1.0) and several reader requests, I&#8217;m updating the walkthrough with screenshots and instructions for v1.1.0. This version will be strictly business: for discussion about the more interesting points of what&#8217;s going on, refer back to the original post <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Step 1: Install Ruby</h2>
<p>To get SASS setup, you’ll first need to install Ruby and Ruby Gems (SASS is bundled with something called “Compass”, and Compass is a “Gem” that can be added into Ruby). You can go the painful route and install Ruby and then add Gems into it. However, if you’re stupid about these things, you can do what I did and just grab the Ruby 1.92 installer–it comes pre-built with Gems already configured.</p>
<h3>Get the <a href="http://rubyforge.org/frs/download.php/74298/rubyinstaller-1.9.2-p180.exe">Ruby 1.92 Installer</a></h3>
<p><a href="http://existdissolve.com/wp-content/uploads/2011/04/rubysplash.jpg"><img class="size-full wp-image-2088" style="display: block;" title="rubysplash" src="http://existdissolve.com/wp-content/uploads/2011/04/rubysplash.jpg" alt="" width="350" height="267" /></a></p>
<h3>When prompted, choose “”Add Ruby executables to you PATH”</h3>
<p><a href="http://existdissolve.com/wp-content/uploads/2011/04/ruby-exec.jpg"><img class="size-full wp-image-2090" title="ruby-exec" src="http://existdissolve.com/wp-content/uploads/2011/04/ruby-exec.jpg" alt="" width="350" height="267" /></a></p>
<p><a href="http://existdissolve.com/wp-content/uploads/2011/04/ruby-exec.jpg"></a>I installed to the default directory on Windows (C:\Ruby192\)</p>
<h2>Step 2: Setup Compass</h2>
<p>Now that Ruby is installed, the next step is to get Compass (e.g., SASS) setup. This step actually took me the longest, simply because I’m stupid about command-line stuff. So here’s a play-by-play of what to do (this is for Windows…I assume Mac is similar), just in case you suffer from a similar level of stupidity:</p>
<ul>
<li>Open a new Command Shell (Start -&gt; Run -&gt; type “cmd”)</li>
<li>Navigate to your Ruby installation directory (cd/ruby192)</li>
<li>Type “<span style="color: #ff0000;"><strong>gem install compass &#8211;pre</strong></span>” – if it works, you should see a bunch of text appear about things being installed, configured, and what not.</li>
<li>BTW, we&#8217;re using &#8220;&#8211;pre&#8221; to get a beta version (0.11) of Compass. This is necessary, as the latest non-beta will break when compiling.</li>
</ul>
<p><a href="http://existdissolve.com/wp-content/uploads/2011/04/compass-install.jpg"><img class="size-medium wp-image-2091" title="compass-install" src="http://existdissolve.com/wp-content/uploads/2011/04/compass-install-300x124.jpg" alt="" width="300" height="124" /></a></p>
<h3>Step 3: Done!</h3>
<p>You&#8217;re done. The next step is to actually <a href="http://existdissolve.com/2011/03/sencha-touch-theming-building-our-custom-stylesheet-with-sass/">start customizing some sassy stylesheets</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2011/04/sencha-touch-theming-1-1-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sencha Touch Theming: Building Our Custom Stylesheet with SASS</title>
		<link>http://existdissolve.com/2011/03/sencha-touch-theming-building-our-custom-stylesheet-with-sass/</link>
		<comments>http://existdissolve.com/2011/03/sencha-touch-theming-building-our-custom-stylesheet-with-sass/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 11:29:22 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Sencha Touch]]></category>
		<category><![CDATA[SASS]]></category>
		<category><![CDATA[theming]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2047</guid>
		<description><![CDATA[Ok, let&#8217;s recap. So far, we&#8217;ve looked at some basic concepts related to how to approach modifying a Sencha Touch app theme, as well as walked through exactly how all the pieces fit together in the SASS magic. With all this behind us, it&#8217;s finally time to create a custom .scss file&#8211;let&#8217;s get started! Setting&#8230;]]></description>
			<content:encoded><![CDATA[<p>Ok, let&#8217;s recap. So far, we&#8217;ve looked at <a href="http://existdissolve.com/2011/03/sencha-touch-theming-getting-started/">some basic concepts</a> related to how to approach modifying a Sencha Touch app theme, as well as walked through exactly how all the <a href="http://existdissolve.com/2011/03/sencha-touch-theming-the-lay-of-the-land/">pieces fit together</a> in the SASS magic. With all this behind us, it&#8217;s finally time to create a custom .scss file&#8211;let&#8217;s get started!</p>
<h2>Setting Things Up</h2>
<p>In the following example, we&#8217;ll be doing some minor riffs on the standard <strong>sencha-touch.css</strong> file. If you&#8217;re in the mood for a super-customized theme of your own, well, you&#8217;ve got a lot of work ahead of you. Instead of jumping headfirst into something like that, why not start with some small changes, and build from there?</p>
<p>First things first, we need to decide where we want our new .scss file to live. While we can put it in the <strong>/resources/sass/</strong> folder where the other core ones are, for this example we&#8217;ll create a new folder at the same level&#8230;just to keep things straight. I&#8217;m going to call mine &#8220;custom&#8221; (pretty creative, eh?).</p>
<p><a href="http://existdissolve.com/wp-content/uploads/2011/03/layout.jpg"><img class="size-medium wp-image-2093" title="layout" src="http://existdissolve.com/wp-content/uploads/2011/03/layout-300x300.jpg" alt="" width="300" height="300" /></a></p>
<p>Now, in order for us to let Compass know where our .scss file lives, we need to create our own config.rb file (check out the last post for more info about this). I&#8217;ll create that file, and here&#8217;s more or less what the contents look like:</p>
<pre># Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css")
environment = :production
output_style = :compressed</pre>
<p>If you were to look at the config.rb file in the resources/sass/ folder, you&#8217;ll notice it&#8217;s the same content. This is fine, since my &#8220;custom&#8221; sass folder is at the same level as the resources/sass folder. If it were put somewhere else, we&#8217;d have to update this file. But for the time being, this will work.</p>
<p>Okay, easy enough. Let&#8217;s close that file&#8230;we don&#8217;t need to do anything else with it.</p>
<p>Next, we need to create a new .scss file. You can call it what you like, but just remember that Compass will make a .css file with the same name that you choose for the .scss. I&#8217;m calling mine custom.scss (again, super original), and here&#8217;s the contents:</p>
<pre>$base-color: #7A1E08;
$base-gradient: 'glossy';
@import 'sencha-touch/default/all';

@include sencha-panel;
@include sencha-buttons;
@include sencha-sheet;
@include sencha-picker;
@include sencha-tabs;
@include sencha-toolbar;
@include sencha-toolbar-forms;
@include sencha-carousel;
@include sencha-indexbar;
@include sencha-list;
@include sencha-layout;
@include sencha-form;
@include sencha-msgbox;
@include sencha-loading-spinner;</pre>
<p>As with the config.rb file, you&#8217;d notice that this is exactly the same as the sencha-touch.scss file. That&#8217;s because I think it&#8217;s easier to start with what&#8217;s already working, and customize from there. If you want headaches, feel free to start from scratch <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Gettin&#8217; Custom</h2>
<p>Alright, now that we have our files setup, we can move on to customizing our new .scss file to create a super-sweet custom .css file that will help our app look a little less generic and whole lot more awesome. Here&#8217;s what I want to do in this example:</p>
<ul>
<li>Change the &#8220;main&#8221; color of the application (from blue-ish whatever to something a little.more.green.)</li>
<li>Pull in some additional icon masks from the huge repository that ships with Sencha (betcha didn&#8217;t know there were so many&#8230;it&#8217;s awesome)</li>
<li>Create a new &#8220;ui&#8221; that we can use for toolbars</li>
</ul>
<h3>Changing the Base Color</h3>
<p>The first task&#8211;changing the &#8220;base&#8221; color&#8211;is stupid-simple. You see the first line of our .scss file? Just change the hex value to the color you want. Yep, that&#8217;s it. I&#8217;m changing mine to something greener:</p>
<pre>$base-color: #7A1E08;</pre>
<p>Done (see, this is easy, right?)</p>
<h3>Icon Masks</h3>
<p>The next task&#8211;pulling in extra icon masks&#8211;is also pretty simple, but first a little context. By default, the sencha-touch.css file has a handful of icon masks defined that can be used in toolbars and whatnot.  These are great, and pretty useful for quite a lot of contexts, but there are only so many defined.</p>
<p>Now before I knew about the awesomeness of SASS in Sencha theming, I did what I thought was a pretty reasonable thing to do: I busted open sencha-touch.css, saw how the icon masks were defined, and replicated them for my own icons. The major problem with this approach, of course, is that:</p>
<ol>
<li>I had to modify a TON of style rules, just to add in a new icon mask</li>
<li>Sencha Touch uses base64 data Urls for image masks&#8230;which means I had to convert my files to base64 urls, add them in, and then bang my head against the wall when they didn&#8217;t work because of tiny typos or whatever other ridiculousness prevented it from working.</li>
<li>Imagine the frustration when the icon mask needs to be updated&#8230;yes, bad idea.</li>
</ol>
<p>One other thing I did not realize is that just because Sencha defaults only a handful of image masks, there are actually about a BILLION icon masks that ship with the installation. If you browse to resources/themes/default/images/pictos/, you&#8217;ll see what I mean.</p>
<p>So all together, the sheer number of icon masks that are provided, combined with the simplicity of SASS, means that there is probably an icon that will fit your needs&#8230;and if there isn&#8217;t, it&#8217;s only a matter of dropping it in the library folder, modifying the .scss to pull it in, and recompile. Stupid-simple.</p>
<p>Alright, enough of that tangent. Let&#8217;s add some icon masks!</p>
<p>With SASS, primarily because Sencha&#8217;s approach already has what&#8217;s called a &#8220;<a href="http://sass-lang.com/#mixins">mixin</a>&#8221; defined for pulling in icon masks to be included in the compiled .css. A mixin is really just a reusable bit combination of CSS, properties, etc. It can even be passed arguments, which is precisely what the pictos-iconmask mixin allows. Here&#8217;s what this mixin looks like (from _mixins.scss:</p>
<pre>@mixin pictos-iconmask($name) {
    .x-tab img.#{$name}, .x-button img.x-icon-mask.#{$name} {
         -webkit-mask-image: theme_image($theme-name, "pictos/" + $name + ".png")
    }
}</pre>
<p>Pretty simple: it looks like a more or less regular kind of function, accepting a single argument (&#8220;name&#8221;), which is used to ultimately establish some custom CSS classes which set an image mask equal to the value of the argument.</p>
<p>And here&#8217;s how we&#8217;ll use that in our .scss file to pull in the custom icon mask of &#8220;flag&#8221;:</p>
<pre>@include pictos-iconmask("flag");</pre>
<p>If it hasn&#8217;t sunk it, pulling in any one or multiple of the hundreds of icon masks from the Sencha pictos repository is as easy as 1.) figuring out the icons name and 2.) implementing the custom mixin using that name. SASS is pretty nifty, eh? <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So before we go on to our final task, a quick word here. If you look at the .css file that&#8217;s generated, and drill specifically into the rules established for these icon masks, you&#8217;ll quickly notice that they eat up a significant number of bytes for each icon mask (because, remember, they&#8217;re using the base64 data urls for the images, which is definitely longer than simply pointing to an image path&#8230;.). Therefore, in an effort to keep your .css file as small and lean as possible, it&#8217;s a good idea to NOT get the fancy idea of simply including every single icon in your .scss file, just so you&#8217;ll have them available. Rather, you should only include the ones that you are absolutely using. What&#8217;s more, it&#8217;s probably a good idea to go the extra step and override the inclusion of the handful of icons that Sencha includes by default. This can be easily done in our custom .scss like so:</p>
<pre>$include_default_icons: false;</pre>
<p>Clear? Excellent. Let&#8217;s wrap this up.</p>
<h3>Defining a Custom &#8220;UI&#8221;</h3>
<p>One of the cool parts about Sencha components is that you can specify a &#8220;ui&#8221; for them to use. Example:</p>
<pre>var myToolbar = <strong>new</strong> Ext.Toolbar({
    dock : 'top',
    title: 'My Toolbar',
    ui: "dark"
});</pre>
<p>This UI, in effect, is just a collection of CSS rules that define how that component should look. By default, Sencha has a few like &#8220;dark&#8221; and &#8220;light&#8221;&#8211;while these are fine and dandy, they leave much to be desired if you want to significantly customize your Sencha Touch app.</p>
<p>Fortunately, like the icon masks we looked at before, ui&#8217;s are controlled by mixins. There are ui mixins for all the major components, and they are pretty simple to customize. First, here&#8217;s what the toolbar ui mixin looks like (from _toolbar.scss):</p>
<pre>@mixin sencha-toolbar-ui($ui-label, $color, $gradient: $toolbar-gradient) {
     $toolbar-border-color: darken($color, 50%);
     $toolbar-button-color: darken($color, 10%);
     .x-toolbar-#{$ui-label} {
          @include background-gradient($color, $gradient);
          border-color: $toolbar-border-color;
          .x-toolbar-title {
               @include color-by-background($color);
               @include bevel-by-background($color);
     }
     ....
}</pre>
<p>And the &#8220;defaults&#8221;:</p>
<pre>@include sencha-toolbar-ui('dark', darken($base-color, 10%));
@include sencha-toolbar-ui('light', $base-color);</pre>
<p>Pretty basic: the &#8220;dark&#8221; and &#8220;light&#8221; uis are created, simply by passing different color values to the mixin. So based on this, it&#8217;s pretty straightforward what we need to do:</p>
<pre>@include sencha-toolbar-ui('charcoal', #333);</pre>
<p>Really, it&#8217;s that simple? Yes, it is. Now, if I go back to my Toolbar component, I can use &#8220;charcoal&#8221; for the UI, and any toolbar that has that UI will have a super-sweet glossy charcoal-y color to it:</p>
<pre>var myToolbar = new Ext.Toolbar({
    dock : 'top',
    title: 'My Toolbar',
    <strong>ui: "charcoal"</strong>
});</pre>
<h2>Wrapping Up</h2>
<p>So it was something of a journey getting to our custom .scss file, but I hope it was worth it. As you can see, customizing a Sencha Touch app with SASS is not only a pretty straightforward proposition, but it is an incredibly powerful option that opens up worlds of possibilities for customizing your app. With SASS, the tediousness of massively complex CSS is minimized, and you can concentrate on implementing your vision for your app&#8217;s aesthetic. Furthermore, the Sencha Touch team has done a really nice job of implementing a really robust set of mixings, variables, and other SASS goodness to make the task of customization stupidly simple.</p>
<p>To put a bow on this, here&#8217;s the final state of my custom .scss file based on this post. Please leave a comment or two if you have questions. Thanks!</p>
<pre>$base_color: #50c20b; // green
$include_default_icons: false;
// import the framework and base components
@import 'sencha-touch/default/all';
@include sencha-panel;
@include sencha-buttons;
@include sencha-sheet;
@include sencha-picker;
@include sencha-tabs;
@include sencha-toolbar;
@include sencha-toolbar-forms;
//comment out components we're not using
//@include sencha-carousel;
//@include sencha-indexbar;
@include sencha-list;
@include sencha-layout;
@include sencha-form;
@include sencha-msgbox;
// include custom icon masks
@include pictos-iconmask("favorites");
@include pictos-iconmask("search");
@include pictos-iconmask("add_black");
@include pictos-iconmask("bookmarks");
@include pictos-iconmask("trash");
@include pictos-iconmask("more");
@include pictos-iconmask("chart2");
@include pictos-iconmask("flag");
@include pictos-iconmask("refresh");
@include pictos-iconmask("home");
@include pictos-iconmask("delete");
@include pictos-iconmask("settings");
@include pictos-iconmask("user_add");
// create custom ui for toolbar
@include sencha-toolbar-ui('charcoal', #333);</pre>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2011/03/sencha-touch-theming-building-our-custom-stylesheet-with-sass/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Sencha Touch Theming: The Lay of the Land</title>
		<link>http://existdissolve.com/2011/03/sencha-touch-theming-the-lay-of-the-land/</link>
		<comments>http://existdissolve.com/2011/03/sencha-touch-theming-the-lay-of-the-land/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 03:31:08 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Sencha Touch]]></category>
		<category><![CDATA[.scss]]></category>
		<category><![CDATA[SASS]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2043</guid>
		<description><![CDATA[If you followed the steps in the last post on setting up your development environment to leverage SASS, you should be all set to start rocking some seriously awesome custom themes for your Sencha Touch app. But before you dive in, you might take a few moments to take a deep breath and survey all&#8230;]]></description>
			<content:encoded><![CDATA[<p>If you followed the steps in the last post on <a href="http://existdissolve.com/2011/03/sencha-touch-theming-getting-started/">setting up your development environment to leverage SASS</a>, you should be all set to start rocking some seriously awesome custom themes for your Sencha Touch app. But before you dive in, you might take a few moments to take a deep breath and survey all that&#8217;s going on to build out the default Sencha Touch theme.</p>
<p>It&#8217;s not that you couldn&#8217;t immediately jump in and produce something awesome&#8211;you definitely could, and it would be pretty simple. I suggest browsing the default theme, however, because despite how easy it is to being customizing your own <strong>.scss</strong> file with new colors, icon masks, and whatever else strikes your fancy, actually understanding (if even in a very preliminary sort of way) what&#8217;s going on will help prevent future frustrations that may dampen your sudden excitement to start theming.</p>
<p>With that thought in mind, let&#8217;s take a few moments to peek around the default theme to see how the magic happens.</p>
<h2>config.rb</h2>
<p>In your Sencha Touch installation, browse to <strong>/resources/sass/</strong>. In this folder, you&#8217;ll see a file named <strong>config.rb</strong>. This file, written in Ruby, is one of those &#8220;setup it up and leave it alone&#8221; kind of files. In a nutshell, this file brings all of theme together, letting the compiler know where particular assets are located, how it should output the content, etc. If you follow the lead of Sencha Touch&#8217;s default theme, this is a file you can leave alone&#8230;or copy and modify according to how you set things up.</p>
<p>One of the more important things to note about this file is the &#8220;load&#8221; directive. This tells the compiler where to find the core assets (.scss files) that contain the code which will generate the ultimate .css files. In the default config.rb file, this loads .scss files located in the <strong>/resources/themes/</strong> folder. We&#8217;ll take a look at that in a second, but for now, just remember that the config.rb file absolutely needs to point to the right location, or else the compilation won&#8217;t work right. So if it&#8217;s working&#8230;leave the file alone!</p>
<p>The last thing to point out is the <strong>css_path</strong> configuration. This is important, because it specifies where the compiled .css file will be saved (in this case <strong>/resources/css/</strong>). And the way that Compass works, there will be a one-to-one correlation between the .scss files that are a part of the compilation and the .css files that are produced. So, if we were to run the compilation in the /resources/sass/ folder, we would find a .css file in the /resources/css/ folder for each .scss that was compiled: in other words, <strong>/resources/sass/sencha-touch.scss = /resources/css/sencha-touch.css</strong>.</p>
<h2>sencha-touch.scss</h2>
<p>I hope that last point was clear. If it wasn&#8217;t, I&#8217;ll reiterate it this way: You know the <strong>sencha-touch.css</strong> file that you are probably loading based on your following of the &#8220;<a href="http://dev.sencha.com/deploy/touch/getting-started.html">Getting Started</a>&#8221; example? All of the style rules in this .css file are the direct result of a compilation of the resources/sass/sencha-touch.scss file. While you probably thought the .css file was the result of some poor slob painstakingly putting together all that complexity, the actual production of the .css file comes as a result of sencha-touch.scss getting compiled, and SASS working its magic.</p>
<p>If you open up <strong>sencha-touch.scss</strong>, you&#8217;ll probably be pretty underwhelmed. It&#8217;s a very small file, but deceptively so. In reality, it is a gateway to initializing the entire beauty of SASS, a process that will eventually involve dozens of other .scss files.</p>
<p>So the very first line you come across is a variable: <strong>$base-color: #7A1E08</strong>.  This one line will control the overall color scheme for the Sencha Touch application. If you were to modify this to, say, some green color, recompiled, and then refreshed your application, you&#8217;d notice that the entire aesthetic of your app would change; that one simple line would have deep impacts in the theme of your application.</p>
<p>That&#8217;s pretty cool in itself, but let&#8217;s keep moving&#8230;A few lines more, we come across the following:</p>
<p><strong>@import &#8216;sencha-touch/default/all&#8217;;</strong></p>
<p>In SASS, you can import other .scss files. So in this example, the sencha-touch.scss file includes another called &#8216;all.scss&#8217;. But where is this file? Well, if you look in <strong>/resources/themes/stylesheets/sencha-touch/default/</strong>, you&#8217;ll find a file named <strong>_all.scss</strong>; despite initial appearances, this is the one that&#8217;s included on sencha-touch.scss.</p>
<h3>HUH?</h3>
<p>Yes, at first it&#8217;s a little confusing. Let&#8217;s break it down, and hopefully it will make more sense.</p>
<p><strong>First off, how does Compass know to look there to find that file?</strong></p>
<p>If you remember the config.rb file we looked at earlier, look at the &#8220;load&#8221; directive. This tells Compass where the theme is located (e.g., the &#8220;themes&#8221; folder).</p>
<p><strong>Okay, but how about the &#8220;stylesheets&#8221; folder? I don&#8217;t remember that being configured anywhere!</strong></p>
<p>True, we didn&#8217;t specify that in config.rb, nor anywhere else. The answer is that this is &#8220;default&#8221; configuration of Compass. There is a configuration variable called &#8220;css_dir&#8221; in Compass&#8230;unless you override, it defaults to &#8220;stylesheets.&#8221; If that&#8217;s something that might drive you crazy, feel free to add <strong>css_dir = &#8220;stylesheets&#8221;</strong> to your config.rb file; it won&#8217;t change anything, but may make getting your head around it a bit easier <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Fine, that makes sense. But how about that &#8220;_all.scss&#8221; file? The import directive didn&#8217;t have an underscore?!?</strong></p>
<p>This is another Compass-thingy. By default, Compass will compile ALL .scss files to .css files. However, you can create what is called a &#8220;<a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#partials">partial</a>&#8220;&#8211;this is just a normal .scss file with an underscore at the beginning of the file name. This tells Compass not to compile, but it&#8217;s still able to find the file and use it.</p>
<h3>Moving On</h3>
<p>Hopefully it&#8217;s now what this simple import statement is doing. The remainder of the sencha-touch.scss file that we&#8217;ve been looking at is the inclusion of the default set of Sencha Touch style collections. While we won&#8217;t get into these right now, you might make note that these can be commented out in order to save precious bytes on the total size of the compiled .css. In other words, if you&#8217;re not going to use something (like Carousel), don&#8217;t include it! The loading speed of your app will thank you.</p>
<h2>_all.scss</h2>
<p>For the last discussion of this exploration, go ahead and find that elusive <strong>_all.scss</strong> file and open it up. You&#8217;ll notice that it&#8217;s yet another gateway file, merely importing more .scss files. As you have time, follow the path of imports, making note of how the files are inherited and what each file does. As you browse these files, you&#8217;ll eventually get to terminal pages that actually have quasi-CSS-looking code. This is where the magic of SASS happens. Using a conglomeration of SASS variables, mixins, and super-sweet rule nesting, the final complexity that is the sencha-touch.css is built, bit by bit. Then all of it is wrapped up, compiled, and spit out as our awesome .css file.</p>
<h2>Wrapping Up</h2>
<p>Yes, I know: we didn&#8217;t actually get to any custom theme building. However, I think the walk through is important, if for nothing else than to provide some exposure to how the many .scss files that make up the final sencha-touch.css file work together. Plus, if you&#8217;ve taken the time to actually understand how all the bits fit together, you&#8217;ll find that setting up your own custom .scss file (or even an entirely custom theme) is a lot less painful and frustrating. After all, creating custom design should be fun and inspiring&#8211;you shouldn&#8217;t have to fight with environmental unknowns when trying to achieve your goals. So even though this little detour has not produced any custom styling, we&#8217;re now in a much better place to start tackling a customization&#8230;and that&#8217;s what we&#8217;ll dive into in the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2011/03/sencha-touch-theming-the-lay-of-the-land/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sencha Touch Theming: Getting Started</title>
		<link>http://existdissolve.com/2011/03/sencha-touch-theming-getting-started/</link>
		<comments>http://existdissolve.com/2011/03/sencha-touch-theming-getting-started/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 16:26:50 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Sencha Touch]]></category>
		<category><![CDATA[Custom Theme]]></category>
		<category><![CDATA[SASS]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2037</guid>
		<description><![CDATA[If you&#8217;ve worked with Sencha Touch for more than 5 minutes, you have GOT to appreciate the aesthetics which the framework brings out of the box. You literally have to do nothing at all in order to get a slick, polished looking interface that works in webkit browsers and on iPhone and Android devices. However,&#8230;]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve worked with <a href="http://www.sencha.com/products/touch/">Sencha Touch</a> for more than 5 minutes, you have GOT to appreciate the aesthetics which the framework brings out of the box. You literally have to do <strong>nothing at all</strong> in order to get a slick, polished looking interface that works in webkit browsers and on iPhone and Android devices.</p>
<p>However, if you&#8217;re like me, you probably get to the point with your apps where you want to customize the look and feel. I mean, while the Sencha Touch default palette is nice, it&#8217;s pretty generic, so before long you&#8217;ll need to start developing a custom theme for your app.</p>
<h2>An Abortive Start</h2>
<p>Initially, this can be a challenge with Sencha Touch apps. The challenge stems not from the fact that anything magical is happening behind the scenes: it&#8217;s just JavaScript, CSS3, and HTML after all. Rather, it&#8217;s the way that it&#8217;s all packaged up.</p>
<p>If you take a look at one of the stylesheets, you&#8217;ll notice how crazy complicated they are. Let&#8217;s say you wanted to change the color of all the navigation backgrounds, for example. Well, you could use Chrome&#8217;s developer tools to inspect each and every interface, grab the selectors, and then try to overwrite them with a custom style sheet (that&#8217;s what I did my first time). But you&#8217;d find that you&#8217;re editing dozens of lines of code, just to make a simple change.</p>
<p>And what about custom navigation toolbar icons? Well, by default Sencha Touch&#8217;s stylesheets use the <a href="http://www.websiteoptimization.com/speed/tweak/inline-images/">base 64 dataUrls</a> of the images within the stylesheets. And there are only a handful available by default. So if you wanted to add your own custom icon, not only would you have to replicate the exact lines of code for navigation icons, but you&#8217;d also have to figure out the base 64 of your image, enter it <em>PRECISELY</em> within the stylesheet, and hope for the best. Best of luck if you ever need to tweak that image in any way.</p>
<p>Sounds onerous, eh? That&#8217;s because using a traditional &#8220;modify and overwrite&#8221; approach to stylesheets won&#8217;t get you very far with customizing your own theme for Sencha Touch. In fact, if you&#8217;re like me, you&#8217;ll get frustrated with it in about 20 minutes and give up.</p>
<h2>Starting Over (The Right Way)</h2>
<p>Fortunately, there is a much better and far less painful way to customize Sencha Touch themes. The answer lies in SASS.</p>
<p>SASS, short for for <a href="http://sass-lang.com/">Syntactically Awesome Stylesheets</a>, is basically an extension of CSS that allows for lots of cool stuff that we all wish CSS had&#8211;variables, nesting selectors, functions or &#8220;mixins&#8221;&#8211;you know, THAT cool stuff <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . SASS makes this happen by using custom files with an extension of &#8220;.scss.&#8221; These files are then compiled in Ruby, and produce a valid, well-formatted .css file. But because of the extensible nature of SASS, simple, intuitive structures in the .scss files can create massively complex .css files, all without the pain of trying to maintain the complexity of the .css file itself.</p>
<p>So for example, let&#8217;s say you wanted to change the default &#8220;base&#8221; color of your Sencha Touch app. If you tried to do this via manual editing of the <strong>sencha-touch.css</strong> style sheet, you&#8217;d quickly find that you have literally hundreds of instances of this one color littered throughout your CSS file. While you could easily do a find-and-replace, that&#8217;s obviously not a great solution, and just opens the door to you messing up and breaking something.</p>
<p>With SASS, you can define this one color as a variable (more about this in future articles), and then use that variable throughout the .scss file to define this color. Yes, that&#8217;s right: define the color once, reuse it to your heart&#8217;s content. And when you&#8217;re sick of that color, you can simply change the value of the variable, and that&#8217;s all you have to worry about. Like I said, it&#8217;s exactly what we all wish CSS could do <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>This one example is just scratching the surface of what SASS can do. I won&#8217;t belabor the point here, but be sure to check out the <a href="http://sass-lang.com/">SASS website</a> to see the full story of what can be accomplished.</p>
<h2>Getting Started With SASS</h2>
<p>Even if changing the one color is all you want to accomplish, you&#8217;ll need to get your environment set up for SASS. Because .scss files are compiled into .css files, you&#8217;ll need to get Ruby set up in your development environment in order to take advantage of the awesomeness of SASS.  Here are the steps for getting everything set up. I&#8217;m deliberately dumbing this process down, since a lot of the tutorials I found assumed more knowledge of command line stuff than I knew when I was setting SASS up. So my apologies if this is overly descriptive.</p>
<blockquote><p><strong><span style="color: #ff0000;">UPDATE!</span> The following is for Sencha Touch 1.0.1. If you are trying to get setup using Sencha Touch 1.1.0, <a href="http://existdissolve.com/2011/04/sencha-touch-theming-1-1-0/">see this updated walk through instead</a>. It will help prevent major compilation fails <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p></blockquote>
<h3>Step 1: Install Ruby</h3>
<p>To get SASS setup, you&#8217;ll first need to install Ruby and Ruby Gems (SASS is bundled with something called &#8220;Compass&#8221;, and Compass is a &#8220;Gem&#8221; that can be added into Ruby). You can go the painful route and install Ruby and then add Gems into it. However, if you&#8217;re stupid about these things, you can do what I did and just grab the Ruby 1.92 installer&#8211;it comes pre-built with Gems already configured.</p>
<ul>
<li>Get the <a href="http://rubyforge.org/frs/download.php/74298/rubyinstaller-1.9.2-p180.exe">Ruby 1.92 Installer</a></li>
<li>Double-click the file to install, and choose &#8220;&#8221;Add Ruby executables to you PATH&#8221;</li>
<li>I installed to the default directory on Windows (C:\Ruby192\)</li>
</ul>
<h3>Step 2: Setup Compass</h3>
<p>Now that Ruby is installed, the next step is to get Compass (e.g., SASS) setup. This step actually took me the longest, simply because I&#8217;m stupid about command-line stuff. So here&#8217;s a play-by-play of what to do (this is for Windows&#8230;I assume Mac is similar), just in case you suffer from a similar level of stupidity:</p>
<ul>
<li>Open a new Command Shell (Start -&gt; Run -&gt; type &#8220;cmd&#8221;)</li>
<li>Navigate to your Ruby installation directory (cd/ruby192)</li>
<li>Type &#8220;gem install compass&#8221; &#8211; if it works, you should see a bunch of text appear about things being installed, configured, and what not.</li>
</ul>
<h3>Step 3: You&#8217;re Done!</h3>
<p>At this point, &#8220;SASS&#8221; is ready to go. In the next article, I&#8217;ll walk through a basic setup for creating a custom theme file for your Sencha Touch app.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2011/03/sencha-touch-theming-getting-started/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

