Using Sass with Titanium Alloy Style Sheets


Today, using CSS frameworks and preprocessors, like LESS and Sass, is an important part of efficient frontend development workflow. These new approaches allow us to use things like variables, mixins, inheritance and imports to make our CSS more flexible, more DRY, and more modular. In short, it makes writing CSS less of a pain.

What if you’re a Titanium developer? How can you harness the power of these CSS tools when styling your app using Alloy TSS?

STSS to the rescue!

STSS is a NPM package that brings the power of Sass into Titanium, allowing you to use all those sexy Sass features in your Titanium apps.

Getting started is easy:

npm install -g stss

I installed the package globally on my machine, but you can it locally in your project if you want. If you install globally like I did, add an Alloy pre-compile hook so that Titanium will compile the STSS files into TSS files before building the project.

To get that pre-compile hook set up, go to your project directory and do this:

stss --jmk

Once you’ve done that, you’re in business! Start naming your Alloy style sheets with a `.stss’ extension, and enjoy the wonderful power of Sass in your Titanium apps!

For more information, check out the official NPM package here. To learn about Sass and all the ways it’ll change your life, check out their site.

Related Posts

Default Yes vs. Default No

Are you and your team members default yes, or default no? One is good for startups, the other not so much.

Check Your Echo Chamber

The people you surround yourself with create your reality. Choose carefully.

Don't Forget the Goal

There's only one thing that matters when you're building software.

How To Get a Job Offer

Want to get a job in the field you love easily? This is how.

Required Reading for All Couples

If you're married, about to get married, or just committed to someone for a long period of time, these three books are absolutely required reading.

I Launched a New Podcast, and I Want You to Call In

I just launched a new podcast called Design By Committee, dedicated to answering your questions about UX, product design, content, strategy and anything else tech.

Shitty Sales Have Made Product Development Harder

Shitty, one-sided sales processes have made product development much more difficult for early stage startups.

Why I'm Cold Emailing You

You might have gotten a cold email from me. Tasteless? Some people think so. Here's why I'm doing it.

How I Found Your Email

I've been cold emailing a lot of people, and many folks are surprised that I found their email. Here's where I dug it up.

Sales is User Research, Undercover