<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>jonpearse.net</title>
		<description>Hi! I’m a freelance full-stack developer based in Cardiff, UK, and I specialise in the creation of beautiful, functional, and usable websites.</description>
		<link>https://jonpearse.net/</link>
		<link href="https://jonpearse.net/_public/feeds/full.xml" rel="self" />
		<language>en-GB</language>
		<lastBuildDate>Mon, 08 Jun 2026 16:59:04 +0100</lastBuildDate>
		<item>
			<title>A letter to myself 10 years ago</title>
			<link>https://jonpearse.net/writing/a-letter-to-myself-10-years-ago/</link>
			<guid>https://jdp.codes/r/gu7y6our</guid>
			<description>
&lt;p&gt;
	This is something I’ve been trying to write for over two and a half years, but I’ve never really been all that happy
	about how it’s turned out during that time. I came close in 2017, but even then I think I was so close to what I
	wanted to write about that I couldn’t see the wood for the trees.
&lt;/p&gt;
&lt;p&gt;
	Maybe it’s because I’ve been giving myself a
	&lt;em&gt;lot&lt;/em&gt;
	more time this past couple of years, maybe it’s because things changed fairly profoundly in May/June last year
	prompting me to think much more about my future.&lt;br&gt;
	Whichever way, Simon Clark’s “&lt;a href=&quot;https://www.youtube.com/watch?v=QuaS2lTVzyM&quot;
	&gt;A letter to myself 10 years ago&lt;/a&gt;” inspired me to have a bash at the format myself, and it seemed to … work.
&lt;/p&gt;
&lt;p&gt;
	I’m still not 100% happy with it, but this is definitely one of those things where it’s better to publish than not, so
	this is what it is: a letter to myself 10 years ago.
&lt;/p&gt;
&lt;section class=&quot;pulled&quot;&gt;
	&lt;p&gt;
		Hi me, it’s you. Or a potential version of you. If it helps, think of me as the third ghost from “A Christmas
		Carol”. Whichever way, things are about to get all kinds of interesting for you, so here are a few things I know now
		that I wish I’d known when I was you.
	&lt;/p&gt;
	&lt;p&gt;
		Enable will go under in 9 months. It’ll be a shock, and while you’ll interview with a couple of companies, you’ll
		also be offered the perfect opportunity to go freelance.
		&lt;br&gt;
		And you’ll love it: you’ll love the flexibility, you’ll learn a huge amount about both yourself and new
		technologies, and you’ll work with some great people on some interesting brands.
	&lt;/p&gt;
	&lt;p&gt;You’ll also burn out. Hard.&lt;/p&gt;
	&lt;p&gt;
		You’re good, you’re fast, and you already have high expectations of yourself. There will be tight deadlines,
		difficult projects, and unpleasant end clients. Because you won’t want to let people down, you’ll work increasingly
		long hours in order to get projects delivered in something that at least approximates on time. At one point, you’ll
		realise the only way you can deliver a project on time is to work on less than two hours’ sleep a night. For two
		weeks straight.&lt;br&gt;
		And you’ll do it.
	&lt;/p&gt;
	&lt;p&gt;
		You’ll first realise something is wrong in the beginning of 2015: you’ll reach the end of a long, difficult, and
		largely pointless project and you’ll feel completely exhausted. You’ll want to take some time out, but you’ll also
		be tied up in contracts and not want to let anyone down.
		&lt;br&gt;
		So you’ll not do anything substantiative about it: to start with you’ll reason you’ll be going on holiday soon
		enough, so you just need to get through the next couple of months until then. When you return and feel no
		better—despite having the best holiday you’ve had to date—you’ll reason that it’ll all resolve itself over time:
		maybe next week, or at the end of the next project.&lt;br&gt;
		Just like the apocryphal frog in the rapidly-heating water, you’ll not realise how bad it is until it’s too late.
	&lt;/p&gt;
	&lt;p&gt;
		By 2017, you’ll need frequent pep-talks to get yourself going in the morning, or to get out of the car and into the
		office once you’ve driven to whichever client you’re working with at the time. You’ll take to hiding in bathrooms
		and crying when it all gets too much, and panic attacks—both minor and more intense—will become commonplace and
		leave you both unwilling and unable to leave your flat.&lt;br&gt;
		You’ll also begin to let people down: not clients—not yet, anyways—but friends, family, your partner. You’ll avoid
		making plans, miss social engagements, and not be there when you really should’ve been.
	&lt;/p&gt;
	&lt;p&gt;
		The shoe will eventually begin to drop in summer 2018: not fully, but enough you finally realise how unwell you are
		and start to take time out to deal with it. This won’t be the end of it: you’ll have a couple of hare-brained ideas
		which will make things slightly worse, and summer 2019 will be all kinds of unpleasant for only tangentially-related
		reasons, but hopefully it’s the start of something better.
	&lt;/p&gt;
	&lt;p&gt;
		That’s not to say it’s all going to be bad, in fact there are a lot of good things to look forward to: you’ll travel
		plenty, you’ll meet some incredible people, and you’ll have plenty of fun while doing it. But it will be more than a
		little overwhelmed by all the bad stuff going on at the same time.
	&lt;/p&gt;
	&lt;hr&gt;
	&lt;p&gt;So here’s what you should do, and what I’m currently doing:&lt;/p&gt;

	&lt;dl&gt;
		&lt;dt&gt;Work less&lt;/dt&gt;
		&lt;dd&gt;
			&lt;p&gt;
				It probably seems obvious, but you don’t need to take on all the work that’s being offered to you, and even with
				the work you will take on, you definitely don’t need to work evenings and weekends.
			&lt;/p&gt;
		&lt;/dd&gt;
		&lt;dt&gt;Take more time off&lt;/dt&gt;
		&lt;dd&gt;
			&lt;p&gt;
				Again this should be obvious, yet here we are. Book breaks between contracts and within long contracts. Don’t be
				afraid to take time unscheduled time off: if your clients are worth keeping they’ll understand, and if they
				don’t understand they’re not worth keeping—good will goes both ways.
			&lt;/p&gt;
		&lt;/dd&gt;
		&lt;dt&gt;Get out of marketing/advertising&lt;/dt&gt;
		&lt;dd&gt;
			&lt;p&gt;
				You dallied with it at Carlson and you’ll return to it as a freelancer: it may be fun and creative in the
				short-term, but ultimately
				&lt;em&gt;none of it matters a damn&lt;/em&gt;.&lt;br&gt;Far too many of the long hours you’re going to pull over the next decade
				will be for sites that precisely no-one outside your team and the end-client’s marketing manager will ever care
				about. They could disappear off the face of the planet—and many will after only a few months—and the world will
				continue to turn, people will continue to go about their lives, and you’ll have absolutely nothing but stress
				and bad posture to show for it.
			&lt;/p&gt;
			&lt;p&gt;
				You’re doing good, meaningful work right now at Enable: don’t let yourself get distracted from that. It is so
				not worth it.
			&lt;/p&gt;
		&lt;/dd&gt;
		&lt;dt&gt;Talk about things&lt;/dt&gt;
		&lt;dd&gt;
			&lt;p&gt;
				You’ll actually do this, but mostly to vent rather than anything more productive. Talk to people, weigh their
				advice, do something about it.
			&lt;/p&gt;
		&lt;/dd&gt;
		&lt;dt&gt;Get help&lt;/dt&gt;
		&lt;dd&gt;
			&lt;p&gt;
				You’ll spend several years trying to convince yourself you can handle this by yourself, or that you aren’t
				deserving of proper help because others have it worse than you. You can’t, and ‘worse’ is subjective—you deserve
				to be happy.
			&lt;/p&gt;
		&lt;/dd&gt;
		&lt;dt&gt;Forgive yourself&lt;/dt&gt;
		&lt;dd&gt;
			&lt;p&gt;
				Seriously: it’s not your fault, and you are
				&lt;em&gt;not&lt;/em&gt;
				beholden to your past. Learn from the mistakes, move on (and if you work out how, let me know)
			&lt;/p&gt;
		&lt;/dd&gt;
	&lt;/dl&gt;
	&lt;hr&gt;
	&lt;p&gt;
		Oh, and take a trip to London and give your grandmother a hug: she doesn’t have long left and you will miss her. So
		much.
	&lt;/p&gt;
&lt;/section&gt;
&lt;p&gt;
	I’m thinking about writing more about this: maybe something sooner about plans, and later about progress/how I’m
	doing. If nothing else, having spent the past several years trying to bottle everything up and pretend it’s OK, I want
	to be more open and honest with myself.
&lt;/p&gt;
&lt;p&gt;
	Besides: I know I’m not the only one going through this, or something like this. Maybe this will be useful, or maybe
	it’ll just be visible.&lt;br&gt;
	To wit, if I’ve said anything you’re curious about, or you want to reach out for any reason—even if it’s just to say
	‘hi’—&lt;a href=&quot;mailto:hello@jonpearse.net&quot;&gt;please do&lt;/a&gt;.
&lt;/p&gt;
</description>
			<pubDate>Fri, 03 Jan 2020 00:00:00 GMT</pubDate>
		</item>
		<item>
			<title>Acknowledging happiness</title>
			<link>https://jonpearse.net/writing/acknowledging-happiness/</link>
			<guid>https://jdp.codes/r/knllzds1</guid>
			<description>&lt;p&gt;It will come as no surprise to anyone who knows me or follows me &lt;a href=&quot;https://twitter.com/jonpearse&quot;&gt;on twitter&lt;/a&gt; that things haven’t been especially fantastic in my world for a little while now. I wrote about a part of it a little over &lt;a href=&quot;/writing/creative-constipation/&quot;&gt;two years ago&lt;/a&gt; and have been meaning to write more since, but suffice to say things have generally been trending downward until my mental health took a fairly profound (but not entirely unexpected) nose-dive last summer from which I am still recovering.&lt;/p&gt;
&lt;p&gt;I will write about it sometime, for no other reason than to try and better understand it myself, but not yet.&lt;/p&gt;
&lt;p&gt;Because despite everything, this week has been awesome.&lt;/p&gt;
&lt;p&gt;I started with a new client on Monday: the work is far from world-changing, the clients’ location means I am spending in excess of three hours a day commuting to and from the office, and I don’t feel like I’ve had a good nights’ sleep all week. But strangely none of that seems important.&lt;br&gt;
Because every day this week I’ve been leaving the office with a smile on my face. The tiredness and frustration that I’ve come to expect has been replaced by satisfaction and accomplishment.&lt;/p&gt;
&lt;p&gt;Earlier today I was stopped in the middle of wrangling Date objects in Javascript by a sudden realisation of just how happy I was: I wanted to sing or shout, but instead—in deference to my colleagues—chose to spend a few moments in quiet mindfulness.&lt;/p&gt;
&lt;p&gt;This post is an extension of that. This feeling won’t last, the contract will end, and the problems I’ve been dealing with will still be there. This too, soon, shall pass.&lt;br&gt;
But too often when things are going badly, we reach for social media to rant and complain, and while the moment passes the tweets and posts do not. Perhaps we should acknowledge happiness more, and that’s what this post is about.&lt;/p&gt;
&lt;p&gt;How has your week been? Maybe it’s worth remembering.&lt;/p&gt;
</description>
			<pubDate>Fri, 03 May 2019 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>Extracting SVG spritesheet dimensions with gulp</title>
			<link>https://jonpearse.net/writing/extracting-svg-spritesheet-dimensions-with-gulp/</link>
			<guid>https://jdp.codes/r/upnuo923</guid>
			<description>&lt;p&gt;I’ve been working on something of a legacy project for a client of late, and about 5pm yesterday QA raised a bug. In the spirit of Sara Soueidan’s recent invocation to “&lt;a href=&quot;https://www.sarasoueidan.com/desk/just-write/&quot;&gt;Just Write&lt;/a&gt;”, I thought I’d write it up in case it’s helpful for anyone else.&lt;/p&gt;
&lt;p&gt;At some point in the history of the project in question, it was updated to use SVG spritesheets in lieu of custom icon fonts. To do this, the author had used &lt;a href=&quot;https://www.npmjs.com/package/gulp-svg-sprite&quot;&gt;gulp-svg-sprite&lt;/a&gt; which, among other things, spits out the dimensions of the individual files into a CSS file for later use.&lt;/p&gt;
&lt;p&gt;This has worked fine, right up until I created an icon with a gradient and came across a &lt;a href=&quot;https://github.com/jkphl/svg-sprite/issues/74&quot;&gt;known bug&lt;/a&gt; where gradients aren’t handled correctly and therefore don’t work in Firefox. Unfortunately, while the issue has been fixed in the repo, it doesn’t seem to have been made available in a public release at time of writing.&lt;/p&gt;
&lt;p&gt;After a bit of poking around, I opted to fix this by replacing gulp-svg-sprite with my usual combination of &lt;a href=&quot;https://www.npmjs.com/package/gulp-svgstore&quot;&gt;gulp-svgstore&lt;/a&gt; and &lt;a href=&quot;https://www.npmjs.com/package/gulp-svgmin&quot;&gt;gulp-svgmin&lt;/a&gt;, with a wee bit of custom glue to generate the required CSS file.&lt;/p&gt;
&lt;h2&gt;Let’s write some code&lt;/h2&gt;
&lt;p&gt;The usual invocation when using gulp-svgstore is something like this:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; gulp &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; svgstore &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp-svgstore&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; rename &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp-rename&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;task&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;svg-sprites&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;path/to/*.svg&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;svgstore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;spritesheet.svg&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;output/directory&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you’re not &lt;em&gt;au fait&lt;/em&gt; with gulp, this ingests all SVG files in the specified directory, compiles them into a single file of &lt;code&gt;SYMBOL&lt;/code&gt; elements and saves the resulting file in &lt;code&gt;output/directory/spritesheet.svg&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So what about generating the CSS file?&lt;/p&gt;
&lt;p&gt;I’m sure there are other ways of doing this but, inspired by &lt;a href=&quot;https://github.com/w0rm/gulp-svgstore#extracting-metadata-from-combined-svg&quot;&gt;an example in the gulp-svgstore documentation&lt;/a&gt;, I elected to process the output stylesheet thus:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; gulp &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; svgstore &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp-svgstore&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; rename &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp-rename&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; through2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;through2&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; cheerio &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;cheerio&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;task&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;svg-sprites&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;path/to/*.svg&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;svgstore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;spritesheet.svg&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;output/directory&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; through2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;file&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; encoding&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; callback&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token comment&quot;&gt;// load the file using cheerio in XML mode&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; $ &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cheerio&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;contents&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;xmlMode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

			&lt;span class=&quot;token comment&quot;&gt;// find all symbols and generate a string of CSS&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; sCssString &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;svg &gt; symbol[viewBox]&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;idx&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; el&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;token comment&quot;&gt;// get the viewbox attr + split it out into components,&lt;/span&gt;
				&lt;span class=&quot;token comment&quot;&gt;// also grab the ID&lt;/span&gt;
				&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; $el &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; el &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// caching for later&lt;/span&gt;
				&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; aViewbox &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; $el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;viewBox&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;&#92;s+&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
				&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; sId &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; $el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;id&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

				&lt;span class=&quot;token comment&quot;&gt;// return a formatted string&lt;/span&gt;
				&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;sId&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;-dims {&#92;n&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
					&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#92;theight: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;aViewbox&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;px;&#92;n&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
					&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#92;twidth: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;aViewbox&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;px;&#92;n}&#92;n&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#92;n&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

			&lt;span class=&quot;token comment&quot;&gt;// write our CSS back to the file stream&lt;/span&gt;
			file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;contents &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Buffer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sCssString &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; file &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token function&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;dimensions.css&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;output/directory &#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I’m using &lt;a href=&quot;https://www.npmjs.com/package/through2&quot;&gt;through2&lt;/a&gt; (mostly out of habit) to give me a slightly nicer interface for dealing with the inbound/outbound file stream, and &lt;a href=&quot;https://www.npmjs.com/package/cheerio&quot;&gt;Cheerio&lt;/a&gt; to parse the SVG and provide a jQuery-like interface for ease of traversal.&lt;/p&gt;
&lt;p&gt;Otherwise, the actual process of finding &lt;code&gt;SYMBOL&lt;/code&gt;s and generating individual CSS rules based on their IDs is relatively simple.&lt;/p&gt;
&lt;h2&gt;Things to mention&lt;/h2&gt;
&lt;p&gt;I mentioned gulp-svgmin earlier, but have not included it in either section of code as it’s not really part of the process in question, but for completeness’ sake, I tend to use it after gulp-svgstore to tidy up the generated code and remove any unwanted elements/attributes.&lt;br&gt;
In the case of this project, I also used it before gulp-svgstore to try and normalise everything before generating the spritesheet (because legacy/folk blindly exporting from Illustrator without tidying things up first).&lt;/p&gt;
&lt;p&gt;More significantly, I also found that in some cases, gulp-svgstore occasionally strips the &lt;code&gt;viewBox&lt;/code&gt; attribute from the &lt;code&gt;SYMBOL&lt;/code&gt; element (even if the source SVG file had one). I wasn’t able to work out why (it was late in the evening and I wanted to go home), so I wound up processing individual files in a separate gulp task:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; gulp &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; rename &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp-rename&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; through2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;through2&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; cheerio &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;cheerio&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; basename &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;path&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;basename&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; rename &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;gulp-rename&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;task&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;svg-sprite-dimensions&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;path/to/*.svg&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; through2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;file&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; encoding&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; callback&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token comment&quot;&gt;// load the file&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; $ &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cheerio&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;contents&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;xmlMode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; $svg &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;svg&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

			&lt;span class=&quot;token comment&quot;&gt;// get the viewbox, height and width attrs&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; sViewbox &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; $svg&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;viewBox&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; fHeight &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; $svg&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;height&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; fWidth &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; $svg&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;width&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

			&lt;span class=&quot;token comment&quot;&gt;// if we have neither height nor width, then try a viewbox&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; Number&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;isNaN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; fHeight &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; Number&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;isNaN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; fWidth &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; aViewbox &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; sViewbox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;&#92;s+&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
				fWidth &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; aViewbox&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
				fHeight &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; aViewbox&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

			&lt;span class=&quot;token comment&quot;&gt;// get a filename so we can generate our rule&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; sFilename &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;path&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.svg&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

			&lt;span class=&quot;token comment&quot;&gt;// create our rule + push it back&lt;/span&gt;
			file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;contents &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Buffer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
				&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;sFilename&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;-dims {&#92;n&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
					&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#92;theight: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;fHeight&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;px;&#92;n&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
					&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#92;twidth: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;fWidth&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;px;&#92;n&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
					&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;}&#92;n&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token function&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;concat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;dimensions.css&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;output/directory&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It’s a slightly different approach, but the overall process is pretty much the same: it just modifies the contents of the individual streams being processed &amp;amp; concatenates the result, rather than doing it all in one place.&lt;/p&gt;
&lt;p&gt;Of course, whether or not you need to do it this way will depend on circumstance: I’ve tested the first approach—processing the spritesheet—with a number of other projects I’ve worked on in the past couple years and it’s worked fine each time. I’m assuming there’s something about the way some of the SVGs were generated in this most recent project that required the alternative approach 🤷‍♂️&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Of course, the internet being the internet, there’s almost certainly a node module that does this automatically and I didn’t find it while I was searching last night, but this was an interesting foray into the world of node and gulp so hey.&lt;/p&gt;
&lt;p&gt;Maybe this will be useful to someone—share and enjoy :)&lt;/p&gt;
</description>
			<pubDate>Wed, 05 Sep 2018 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>UX Special and CSS Day 2018</title>
			<link>https://jonpearse.net/writing/ux-special-and-css-day-2018/</link>
			<guid>https://jdp.codes/r/usjz57ar</guid>
			<description>&lt;p&gt;I’m on my way back from Amsterdam and the 6th iteration of the ever-wonderful &lt;a href=&quot;https://cssday.nl&quot;&gt;CSS Day&lt;/a&gt; conference. This time around, the first day—the theme of which varies from year to year—was all about UX.&lt;/p&gt;
&lt;p&gt;This is a quick write-up of everything while it’s still relatively fresh in my mind: I’ll probably miss a few bits out (because there was a &lt;em&gt;lot&lt;/em&gt; of information in a relatively short spot of time), but it should hopefully give you a reasonable taste of &lt;s&gt;what you missed&lt;/s&gt; what happened over the two days.&lt;/p&gt;
&lt;h2&gt;Day One: UX Special&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://craftui.com&quot;&gt;Alla Kholmatova&lt;/a&gt; started the conference talking about the importance of building a set of design principles: the underlying guidelines by which the design process should be run. These should be genuine, opinionated, actionable, and memorable—with no more than three to five in total. They should also be defined with the audience and goals in mind, rather than being abstract, and should be continually re-assessed to ensure that they still work.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://jennyshen.com&quot;&gt;Jenny Shen&lt;/a&gt; told us how to &lt;strong&gt;build bridges, not walls&lt;/strong&gt; when designing for users across cultures. She emphasised the importance of understanding both the local culture and traditions of our audience, as well as the existing conventions already being used within the web and mobile apps—for example, that while western sites/apps use the ‘Hamburger’ or ‘three dots’ icon to denote a menu/additional options, in China a ‘Discover’ option is far more widely used and understood. She also mentioned that when looking for existing research, your search should be for content in your audience’s native language, rather than your own.&lt;br&gt;
And never use machine translation: just… don’t.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/msjaneaustin&quot;&gt;Jane Austin&lt;/a&gt; gave us ten (actually eleven) ways to irritate our design teams. She talked about the &lt;a href=&quot;https://www.designcouncil.org.uk/news-opinion/design-process-what-double-diamond&quot;&gt;double diamond&lt;/a&gt; and the importance of building the right thing, and building the thing right. Also, that it is sometimes far more productive to stay with sketches and wireframes for longer as people find it easier to be critical of them, without getting too invested in/distracted by the visual designs. For the curious, the eleven ways were:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;asking designers ‘just to colour in the wireframes’&lt;/li&gt;
&lt;li&gt;treating designers as feature factories (+ don’t fake agile)&lt;/li&gt;
&lt;li&gt;treating projects as ‘ship and forget’, with no time to fix and revisit at a later stage&lt;/li&gt;
&lt;li&gt;doing the above until technical debt has piled up so high that it is impossible to ship anything at all&lt;/li&gt;
&lt;li&gt;poor hiring and onboarding practices&lt;/li&gt;
&lt;li&gt;not providing designers with a future&lt;/li&gt;
&lt;li&gt;not allowing proper time for research (+ responding to what people want, rather than what they need)&lt;/li&gt;
&lt;li&gt;overloading everyone with meetings (managers typically split their days into 30min slots, whereas designers—and developers—work in multi-hour chunks, leading to scheduling conflicts)&lt;/li&gt;
&lt;li&gt;having a poorly set-up workspace (walls on which to stick post-its are absolutely essential)&lt;/li&gt;
&lt;li&gt;culture (if the culture is bad, people won’t want to work for you)&lt;/li&gt;
&lt;li&gt;micromanagement (no-one likes a &lt;a href=&quot;http://hoveringartdirectors.tumblr.com/&quot;&gt;hovering art director&lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/bdc&quot;&gt;Benjamin de Cock&lt;/a&gt; explained how clever design and animation can help user experience, but only if done properly. Subtle transitions and animations can be really useful to illustrate how an interface is working, and purely decorative elements can make an interface seem more ‘friendly’ and welcoming, but taken too far they can actively get in the way of what users are trying to achieve. Websites should also respect the user’s preferences—if iOS users have opted to reduce motions in their UI, your website should also do so.&lt;br&gt;
From a development perspective, only the &lt;code&gt;transform&lt;/code&gt; and &lt;code&gt;opacity&lt;/code&gt; CSS properties are ‘cheap’ to animate, and with a little lateral thinking, many effects can be created with combinations of the two. Where this is not possible, SVG animations should be used instead, especially as they will use subpixel aliasing, resulting in smoother animations.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.visualcinnamon.com/&quot;&gt;Nadieh Bremer&lt;/a&gt; shared her experience of working on &lt;a href=&quot;http://datasketch.es&quot;&gt;Data Sketches&lt;/a&gt;, a data-visualisation project in collaboration with &lt;a href=&quot;http://sxywu.com&quot;&gt;Shirley Wu&lt;/a&gt;. She talked through her process of creating a visualisation, starting with sourcing and ascertaining the accuracy and completeness (use google, don’t be afraid to break out the spreadsheets), and emphasised the importance of sketching ideas out as a way of catching any errors in the design or data before committing too much to code.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.smashingmagazine.com/&quot;&gt;Vitaly Friedman&lt;/a&gt; talked about how terrible the average ecommerce experience is for users: extra costs, limited payment methods, enforced sign-up, and a perceived lack of trust in the platform leads to an almost-70% abandonment rate (in particular, 54% of users will abandon the process when asked to sign up, 75% if they have to go through a ‘recover password’ process). He also talked about the importance of reviews (4.83/5 stars is optimal, apparently), breadcrumbs, and ‘thumb-driven design’: that folk using mobile devices are more accurately able to hit targets in the centre of a touchscreen than in the corners.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://idaaa.no/&quot;&gt;Ida Aalen&lt;/a&gt; told us how she does user testing on a budget, impressing that developers and designers aren’t suitable candidates for testers (they’re all a little too genre-savvy), as well as warning against testing by usability experts who apparently miss 50% of actual user issues, whilst 33% of raised issues are actually false flags.&lt;br&gt;
Instead, we should be going out into the world—with snacks—and testing with real live people, asking them to perform tasks (without helping) whilst thinking out loud and explaining what they’re doing.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://andybudd.com/&quot;&gt;Andy Budd&lt;/a&gt; closed the day out talking about becoming an ‘Accidental Design Leader’ (although everything he said could apply to anyone in a leadership position). He highlighted that many people see leadership as power and that power is necessary to make change, whereas in many organisations it’s far more complex than that, and that leaders should stand between them and the larger organisation.&lt;/p&gt;
&lt;h2&gt;Day Two: CSS Day&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://meyerweb.com&quot;&gt;Eric Meyer&lt;/a&gt; began the day talking about the ‘Friction of Web Standards’; explaining that some apparently simple browser features take far longer than might be expected to become standards because they’re actually quite difficult beneath the surface. His example was the humble border radius, and how it interacts with background images, box shadows, and differing border styles and thicknesses. He also highlighted the ‘long tail’ of the internet: that the first website still works, and that the browser default styles for &lt;code&gt;blockquote&lt;/code&gt; elements have a left margin (or inline-start margin, if you will) of 40px because that’s what Mosaic did, and therefore the implicit requirement of decisions to be made ‘right’ rather than ‘quick’.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://clagnut.com&quot;&gt;Richard Rutter&lt;/a&gt; talked us through the ‘Golden Rules for Typography on the Web’: how display text—for titles and such—should often be treated differently to paragraph text, and how both should be sized across different devices to attain maximum readability. He also talked about variable fonts—a part of the CSS Fonts level 4 spec—which allows full manipulation of a number of different axes (font weight, slant, spacing, etc) whilst only distributing a single file over the wire.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://hiddedevries.nl&quot;&gt;Hidde de Vries&lt;/a&gt; took us on a journey through 100 years of graphic design to show us that the ’Web is ready for great graphic design’. Through the works of Jan Tschichold and Josef Müller-Brockmann, he explained how CSS Flexbox and Grid in conjunction with CSS viewport units can make our lives substantially easier without having to resort to 12-column layouts and CSS frameworks like Bootstrap.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://sarasouiedan.com&quot;&gt;Sara Souiedan&lt;/a&gt; then proceeded to blow our minds with a fast-paced introduction into the world of &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/SVG/Element/filter&quot;&gt;SVG filters&lt;/a&gt;. In contrast to the somewhat limited set of CSS filters (which are applied one after the other), SVG has nineteen individual filters which can be combined in any way you wish, and therefore can be used to do Photoshop-like effects in the browser in real time. She started off with a simple drop shadow (which, unlike CSS, supports complex shapes rather than just rectangles) before showing us how to implement displacement effects and, eventually, a rather attractive crumpled paper texture via judicious use of noise generators (I will &lt;em&gt;so&lt;/em&gt; be experimenting with this!)&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/gregwhitworth&quot;&gt;Greg Whitworth&lt;/a&gt; talked about container queries, why we don}t have them yet, and why we probably don’t actually need them because CSS flex and grid along with object-fit and viewport units can do a lot of what we are trying to achieve in a much more performant way, albeit with a little more lateral thinking. He talked about &lt;code&gt;ResizeObserver&lt;/code&gt; (wonderful but almost completely unsupported) and &lt;code&gt;IntersectionObserver&lt;/code&gt; and how they can be used to provide container query-like behaviour when required, but also highlighted the importance of deciding whether the designed behaviour was actually strictly required as opposed to merely being desirable, and therefore whether it was actually needed at all.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.chenhuijing.com/&quot;&gt;Hui Jing Chen&lt;/a&gt; talked about how we as CSS folk are ‘programmers of boxes’ as she covered the intricacies of boxes in CSS. With the help of some especially endearingly-illustrated slides, she talked about box positioning, flow context (aka, how to clearfix without, well… clearfix), and finally CSS flex and grid, and how it all works together with writing direction and the myriad &lt;em&gt;possibilities&lt;/em&gt; it all gives us.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://ireaderinokun.com/&quot;&gt;Ire Aderinokun&lt;/a&gt; talked about building websites for the ‘next billion users’, likely to be users of much-improved assistive technologies, non-English speakers, folk using the internet primarily on mobile devices, and those with poor internet access. She talked about building performant sites, that are easy to internationalise, and that are highly accessible (something we seem to have forgotten over the years). This applies equally in code, where we should be using the right tool for the job (CSS for presentation, JS for behaviour), ensuring our CSS classes and variables are named globally (‘sidebar’, rather than ‘left’), and choosing CSS selectors appropriately (ID and class are way more performant than :nth-child and pseudos).&lt;/p&gt;
&lt;p&gt;Finally, &lt;a href=&quot;http://www.brucelawson.co.uk&quot;&gt;Bruce Lawson&lt;/a&gt; took on the subject of CSS-in-JS, talking about some of the reasons for the cultural clash that has been taking place since its arrival in the world, and offering a potential solution in the shape of &lt;a href=&quot;https://stylable.io&quot;&gt;Stylable&lt;/a&gt;: a component-friendly pre-processed framework that compiles down into vanilla CSS. There was also distribution of mohawked potatoes through the audience, but … you kinda had to be there.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;All of which is a lot of words that really can’t do the conference justice: there was so much tremendously good stuff covered at the conference, and I’ve come away with a list of projects, techniques, and APIs, some of which will be worked into projects directly, and others—like everything from Sara’s talk—that I can’t wait to take a deeper dive into and have fun with. The hardest part thus far is prioritising everything instead of trying to do it all at once!&lt;br&gt;
More than that, though, it was the opportunities to meet developers, designers, UXers, and others from all over the world (albeit, mostly from the Netherlands) and to chat ideas, inspiration, and web tech in such an enthusiastic and relaxed atmosphere.&lt;/p&gt;
&lt;p&gt;If you want more, take a look at the &lt;a href=&quot;https://twitter.com/cssdayconf&quot;&gt;CSS Day twitter feed&lt;/a&gt;, &lt;a href=&quot;http://twitter.com/stephaniecodes&quot;&gt;Stephanie Nemeth&lt;/a&gt; took some &lt;a href=&quot;https://twitter.com/i/moments/1008626433114148866&quot;&gt;amazing sketchnotes&lt;/a&gt;, and you’ll almost certainly want to keep an eye on the &lt;a href=&quot;https://vimeo.com/webconferences&quot;&gt;CSS Day Vimeo channel&lt;/a&gt; where videos of the conference will be joining those from previous years over the next few months.&lt;/p&gt;
&lt;p&gt;And, of course, CSS Day will be returning next year with a UI special: provisional dates are June 13–14th, but keep an eye on &lt;a href=&quot;https://cssday.nl/&quot;&gt;the website&lt;/a&gt; for updates. I’ll see you there!&lt;/p&gt;
</description>
			<pubDate>Tue, 19 Jun 2018 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>Gem updates</title>
			<link>https://jonpearse.net/writing/gem-updates/</link>
			<guid>https://jdp.codes/r/gw509yn9</guid>
			<description>&lt;p&gt;I’ve had some downtime of late following the end of my most recent contract, and I might possibly write about the larger part of my motivation behind this at some later point, but it has given me the opportunity to do some ‘personal’ projects, including a few bits and pieces that I’m releasing as open-source.&lt;/p&gt;
&lt;p&gt;Thus, a quick summary of a few Ruby Gems I’ve released/updated recently.&lt;/p&gt;
&lt;h2&gt;&lt;code&gt;devise_date_restrictable&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This is an extension for the widely-used &lt;a href=&quot;https://github.com/plataformatec/devise&quot;&gt;Devise gem&lt;/a&gt; that allows restriction of user access by date (either before- or after a single date, or between two dates). It’s fairly self-contained and simple to use, so if you’ve used Devise before, there shouldn’t be anything too surprising in &lt;code&gt;devise_date_restrictable&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Careful observers will note that this isn’t an especially &lt;em&gt;new&lt;/em&gt; gem. I originally wrote it about a year ago for &lt;a href=&quot;https://sonr.global&quot;&gt;Sønr&lt;/a&gt; and released it as 0.0.1 at the time, it’s just taken until now to have enough time to polish it into a properly releasable (ie, 1.0.0) state.&lt;/p&gt;
&lt;p&gt;For more information, check out the &lt;a href=&quot;https://github.com/jonpearse/devise_date_restrictable&quot;&gt;Github repo&lt;/a&gt; or &lt;a href=&quot;https://rubygems.org/gems/devise_date_restrictable&quot;&gt;RubyGems page&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;code&gt;simple_ar_localizer&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This is a utility gem that ties into &lt;a href=&quot;http://guides.rubyonrails.org/i18n.html&quot;&gt;Rails’ I18n framework&lt;/a&gt; and—hopefully—gives you a slightly easier interface for localising ActiveRecord objects without having to mess around with awkwardly-nested YAML files. This is especially useful if, like me, you like breaking your localisations up into per-model files to keep everything in a reasonably obvious place.&lt;/p&gt;
&lt;p&gt;Out of the box, it handles ‘human’ model names and attribute names (including pluralisation), as well as validation/error messages defined on both a per-model or per-attribute basis. Beyond that, it has a fairly extensible configuration to allow you to use it in any way you so desire.&lt;/p&gt;
&lt;p&gt;Again, this is something that came from Sønr and that has been released into the wild in case it proves useful for anyone else.&lt;/p&gt;
&lt;p&gt;More information—including documentation + examples—can be found in the &lt;a href=&quot;https://github.com/jonpearse/simple_ar_localizer&quot;&gt;Github repo&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;code&gt;grouped_property_scss_linter&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This is definitely not a new gem and I’ve written about it before, but in the process of rebuilding this site I found that it really didn’t like &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables&quot;&gt;CSS custom properties&lt;/a&gt; (‘variables’). A little digging and bugfixing later, and it’s back to being useful once more.&lt;/p&gt;
&lt;p&gt;Whilst I was at it, I also informed it of a few properties—mostly surrounding CSS Grid—about which it had hitherto been unaware. I’m still not 100% sure whether grid content or -parent properties should go first, but at least it doesn’t ignore them completely!&lt;/p&gt;
&lt;p&gt;As with everything else more information, documentation, and the like is on &lt;a href=&quot;https://github.com/jonpearse/grouped_property_scss_linter&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;…&lt;/p&gt;
&lt;p&gt;Share and enjoy!&lt;/p&gt;
</description>
			<pubDate>Wed, 06 Jun 2018 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>Creative Constipation</title>
			<link>https://jonpearse.net/writing/creative-constipation/</link>
			<guid>https://jdp.codes/r/jyvqe3ld</guid>
			<description>&lt;p&gt;The observant among you will have notice that I have, once more, gone a year without updating this site.&lt;br&gt;
Whilst I can attribute at least some of this inactivity to a general lack of free time, a lot of it comes down to what I have chosen to call ‘creative constipation’, a phrase for which I can only apologise. (but c’mon: the alliteration was too good to ignore!)&lt;/p&gt;
&lt;p&gt;This is not an especially new thing for me: over the past couple years, I’ve been growing increasingly… discontent with many aspects of life, most of which are focussed around ‘the job’.&lt;br&gt;
For much of that time, though, I’ve found it difficult to really put my finger on what exactly is wrong. It has been obvious that at least some of it was to do with the &lt;em&gt;kind&lt;/em&gt; of work that I’ve been doing (as well as the quantity in which it has sometimes arrived), but I know that’s only a part of it: that there is something far deeper and just that little bit out of touch.&lt;/p&gt;
&lt;p&gt;If you can’t define a problem, it’s bloody difficult to work out how you’re going to solve it.&lt;/p&gt;
&lt;p&gt;But that changed last month with a week-long trip to the Netherlands for the brilliant &lt;a href=&quot;https://cssday.nl/2017&quot;&gt;CSS Day Conference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It goes without saying that the conference itself was amazingly good, and was worth the ticket price alone to listen to &lt;a href=&quot;https://en.wikipedia.org/wiki/H%C3%A5kon_Wium_Lie&quot;&gt;the&lt;/a&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Bert_Bos&quot;&gt;inventors&lt;/a&gt; of CSS talk for an hour on the early days of CSS, what they thought of more recent developments, and what they’d have done differently in retrospect.&lt;/p&gt;
&lt;p&gt;But of the talks, there were four that especially spoke to me: &lt;a href=&quot;http://rachelnabors.com/&quot;&gt;Rachel Nabors&lt;/a&gt; spoke about CSS Animations, &lt;a href=&quot;http://rumyrashead.com&quot;&gt;Ruth John&lt;/a&gt; about the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API&quot;&gt;Web Audio API&lt;/a&gt;, &lt;a href=&quot;https://rachelandrew.co.uk/&quot;&gt;Rachel Andrew&lt;/a&gt; about &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout&quot;&gt;CSS Grids&lt;/a&gt;, and &lt;a href=&quot;http://jensimmons.com/&quot;&gt;Jen Simmons&lt;/a&gt; about writing modes and CSS (and a bit of CSS Grid for good measure).&lt;br&gt;
With the exception of all things CSS Grid (which is cool stuff, yo), none of them really had anything to do with the kind of work that I do on a day-to-day basis, but they reminded me that the web can be &lt;em&gt;fun&lt;/em&gt; and deeply creative in a way that I’d almost forgotten.&lt;/p&gt;
&lt;p&gt;But beyond the conference, while we were in the Netherlands, we visited &lt;a href=&quot;https://www.museumspeelklok.nl/lang/en/&quot;&gt;Museum Speelklok&lt;/a&gt; in Utrecht, and the &lt;a href=&quot;https://www.gemeentemuseum.nl/en/home&quot;&gt;Gemeentemuseum&lt;/a&gt; in Den Haag.&lt;br&gt;
I’d learned of Museum Speelklok—the museum of self-playing instruments—thanks to &lt;a href=&quot;http://www.wintergatan.net&quot;&gt;Martin Moulin&lt;/a&gt; of &lt;a href=&quot;https://www.youtube.com/watch?v=IvUU8joBb1Q&quot;&gt;ridiculous marble machine&lt;/a&gt; fame, and we visted Gemeentemuseum because they had two exhibitions running simultaneously: one celebrating the centenary of the birth of &lt;a href=&quot;https://en.m.wikipedia.org/wiki/De_Stijl&quot;&gt;De Stijl&lt;/a&gt;, and the other a retrospective on the work of &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Piet_Mondrian&quot;&gt;Piet Mondriaan&lt;/a&gt; (in fact, the largest collection of his work ever exhibited).&lt;/p&gt;
&lt;p&gt;Both museums were hugely inspiring: the first as both a musician and a maker, and the second… well, strangely, that inspired me to do some strange things with CSS, but more about that in a future post (suffice to say, I &lt;em&gt;really&lt;/em&gt; like neoplasticism).&lt;/p&gt;
&lt;p&gt;Between CSSDay and wandering around various museums, I came home from the Netherlands fired up to do some really cool stuff.&lt;/p&gt;
&lt;p&gt;And this is where we come back to creative constipation: I wanted to do something creative, I’d spent a few hours here and there sketching up some ideas, I made some free time during which to work on everything. I even started playing with some neoplasticism-inspired CSS hacks.&lt;/p&gt;
&lt;p&gt;But then when the time came, when I had a glorious weekend to myself… nothing. All that inspiration and… nothing.&lt;/p&gt;
&lt;p&gt;The same applies to making: I started the year with a flurry of electronics projects, I invested in some new kit, and acquired a bulk order of components so I could ‘just build’ when the inspiration struck rather than having to order stuff in first… and yet, with all the time in the world, nothing.&lt;br&gt;
And then music: I have a couple guitars, a recorder, a flute, and a keyboard knocking around the flat. The other week, I found that Korg has released a software version of their &lt;a href=&quot;https://en.wikipedia.org/wiki/Korg_Wavestation&quot;&gt;Wavestation&lt;/a&gt; as an &lt;a href=&quot;https://itunes.apple.com/us/app/korg-iwavestation/id1118072618?mt=8&quot;&gt;iPad App&lt;/a&gt; (and I love me the Wavestation), so I bought it and got a USB–MIDI interface so I could hook my old keyboard up to my iPad … but still, nothing.&lt;/p&gt;
&lt;p&gt;I have a surfeit of inspiration, I have sketches and notes of ideas, I have the tools by which I can bring that inspiration and those ideas into reality, I even have the time to do it… and yet, nothing.&lt;/p&gt;
&lt;p&gt;I am creatively constipated, and it sucks.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;And that, I think, is the crux of everything that has been going on these past two years: with the greatest of respect for those with whom I have been working, a majority of the projects I’ve worked on have felt … samey and uninspiring—the same old stuff dressed in new clothes. Whilst it has been many things, and has given me the opportunity to work with some amazing people (you know who you are ❤️), it has left me feeling creatively unfulfilled and wanting.&lt;br&gt;
If creativity is a muscle, mine has withered and wasted, and leaves me unable to flex it when I want… and it sucks.&lt;/p&gt;
&lt;p&gt;Things need to change, and now I’ve gotten to the bottom of ‘why’, I can start thinking about what I need to do to change it. I already have some fairly big plans under way, but top of that list is re-engaging with my creativity.&lt;br&gt;
Some of the things I’m planning scare me, but I think that’s a healthy sign: I’ve lived too comfortably for too long and it’s made me fat and lazy. It’s time to do something different.&lt;/p&gt;
&lt;p&gt;This is going to be fun. And scary. But mostly fun.&lt;/p&gt;
</description>
			<pubDate>Sat, 29 Jul 2017 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>On linting, and bringing order to SASS</title>
			<link>https://jonpearse.net/writing/on-linting-and-bringing-order-to-sass/</link>
			<guid>https://jdp.codes/r/3wazv9g9</guid>
			<description>&lt;p&gt;&lt;strong&gt;2019 update&lt;/strong&gt;: with SASS being ported from Ruby to Dart, SCSS-Lint is no longer being maintained, and the SCSS-Lint team &lt;a href=&quot;https://github.com/sds/scss-lint#notice-consider-other-tools-before-adopting-scss-lint&quot;&gt;recommends using other tools instead&lt;/a&gt;. This post is left for curiosity’s sake.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Recently I’ve been working on-and-off on my front-end tookit (ie, the basic CSS/JS/etc I use to bootstrap projects). I’m almost ashamed to admit that it’s taken this long, but let’s file it along with the shoemaker’s children and move on.&lt;br&gt;
Whilst the overall process is something for another blog post, it’s spawned a couple of interesting side-projects, one of which has got to the stage where I can consider it ‘ready for the world’.&lt;/p&gt;
&lt;p&gt;This particular side project came about after going to work with the lovely folk at &lt;a href=&quot;https://www.mrbandfriends.co.uk&quot;&gt;Mr B &amp;amp; Friends&lt;/a&gt; in Bath, who sometime earlier this year began to roll out SASS linting using the &lt;a href=&quot;https://github.com/brigade/scss-lint&quot;&gt;SCSS-Lint&lt;/a&gt; Node plugin.&lt;/p&gt;
&lt;p&gt;Now, those who have worked with me in the past might think that I have something against linting: certainly, I’ve been known to express an opinion or two.&lt;br&gt;
The truth is, though, I’m actually really quite fond of linting… as long as it’s sane.&lt;/p&gt;
&lt;h2&gt;Let’s talk CSS Property Ordering&lt;/h2&gt;
&lt;p&gt;When you get started with SCSS-Lint, one of the linters enabled by default is called &lt;a href=&quot;https://github.com/brigade/scss-lint/blob/master/lib/scss_lint/linter/README.md#propertysortorder&quot;&gt;PropertySortOrder&lt;/a&gt; and forces a strict ordering of properties within each rule.&lt;/p&gt;
&lt;p&gt;This makes reasonable sense when writing ‘Vanilla’ CSS, as there are &lt;a href=&quot;https://www.barryvan.com.au/2009/08/css-minifier-and-alphabetiser/&quot;&gt;some benefits&lt;/a&gt; to doing so beyond just ‘looking good’.&lt;br&gt;
However, when writing SASS—or any other precompiled format—I would suggest that by the time your code has been through the precompiler and anything else in your toolchain, there’s a good chance things aren’t quite as neat as they might have been to start with.&lt;/p&gt;
&lt;p&gt;Besides which, I don’t know about anyone else, but I’m not especially great at remembering a specific order of all 500+ CSS properties, and having to constantly parse the output of a linter and rejig my code gets very old very quick.&lt;/p&gt;
&lt;h2&gt;Less order, more collation&lt;/h2&gt;
&lt;p&gt;That’s not to say this kind of linting is &lt;em&gt;bad&lt;/em&gt;, just a little unnecessary. There is a lot to be said for keeping your CSS neat, and to this end many developers—myself included—have taken to grouping similar/related properties together within rules (&lt;a href=&quot;https://smacss.com&quot;&gt;SMACSS&lt;/a&gt;, for example, talks about &lt;a href=&quot;https://smacss.com/book/categorizing&quot;&gt;categorising properties&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;However, I’m not especially fussed about the particular order of individual properties within each of these groups or categories. As long as—say—positional properties are all grouped together, I’m not too bothered if &lt;code&gt;top&lt;/code&gt; is specified before &lt;code&gt;left&lt;/code&gt; or vice-versa.&lt;/p&gt;
&lt;p&gt;Hopefully this strikes some kind of happy medium: your SASS is—hopefully—clean and readable, but without the overhead of having to worry about exactly which properties go in which order.&lt;br&gt;
Less worrying about pleasing the linter makes for happier developers, who can then concentrate on more important things. Those owls won’t lobotomise themselves, after all.&lt;/p&gt;
&lt;p&gt;I did have a look around for an SCSS-Lint plugin that allowed this kind of fuzzy grouping of properties, but my search came up blank.&lt;br&gt;
So I wrote my own…&lt;/p&gt;
&lt;h2&gt;Introducing &lt;code&gt;grouped_property_scss_linter&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/jonpearse/grouped_property_scss_linter/&quot;&gt;grouped_property_scss_linter&lt;/a&gt; is a catchingly-titled SCSS-Lint plugin gem designed to replace the default &lt;code&gt;PropertySortOrder&lt;/code&gt; and provide a saner linting experience, based on grouping CSS properties within a rule.&lt;br&gt;
As long as the groups are in the right order and have suitable (and configurable) separation, the linter is happy.&lt;/p&gt;
&lt;p&gt;Thus, whilst…&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.myClass&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #333&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;… is bad, either of&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.myClass&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #333&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;.myOtherClass&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #333&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;… is just fine.&lt;/p&gt;
&lt;p&gt;Which hopefully makes for happier developers, and that can only be a good thing. Unless you’re an owl.&lt;/p&gt;
&lt;p&gt;I’ve spent the past month kicking it around in various projects, and it seems to be working OK… well enough that I think it’s ready to be inflicted upon the world.&lt;br&gt;
It’s currently available—with a readme—on my &lt;a href=&quot;https://github.com/jonpearse/grouped_property_scss_linter/&quot;&gt;github account&lt;/a&gt;. Check it out, kick it about a bit, let me know what you think.&lt;/p&gt;
&lt;h2&gt;But what about…&lt;/h2&gt;
&lt;p&gt;As I mentioned earlier, there are good reasons for using strict-ordering within your CSS, and this linter doesn’t really help you get there.&lt;/p&gt;
&lt;p&gt;Fortunately, for those using a Node toolchain to compile SASS, there’s a Node module called &lt;a href=&quot;https://github.com/hudochenkov/postcss-sorting&quot;&gt;postcss-sorting&lt;/a&gt; that will order your CSS properties to your satisfaction after everything’s been compiled.&lt;br&gt;
Other solutions for other platforms may exist, I’ve not really looked as yet.&lt;/p&gt;
&lt;p&gt;Finally, for those who want this kind of grouped property linting but aren’t using SASS, the &lt;a href=&quot;https://github.com/stylelint/stylelint&quot;&gt;stylelint&lt;/a&gt; Node module does approximately the same thing for vanilla CSS, and may have influenced this linter gem more than a little.&lt;/p&gt;
</description>
			<pubDate>Fri, 15 Jul 2016 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>#TILJS: Converting from NodeLists to Arrays</title>
			<link>https://jonpearse.net/writing/tiljs-converting-from-nodelists-to-arrays/</link>
			<guid>https://jdp.codes/r/5f0z1c3a</guid>
			<description>&lt;p&gt;&lt;strong&gt;2021 update:&lt;/strong&gt; NodeList has had its own &lt;code&gt;forEach&lt;/code&gt; iterator for &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach&quot;&gt;a little while now&lt;/a&gt;, so unless you’re—for some reason—supporting IE11, you probably shouldn’t be using anything I wrote about in this post. I will, however, leave it here for curiosity.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;A couple days ago, the highly esteemable &lt;a href=&quot;http://jegtnes.co.uk/&quot;&gt;Mr Jegtnes&lt;/a&gt; launched &lt;a href=&quot;http://tiljs.jegtnes.co.uk/&quot;&gt;TIL JS&lt;/a&gt;: a side-project born from a desire to improve his JavaScript skills.&lt;/p&gt;
&lt;p&gt;It’s a brilliant idea, and given two of my goals this year are to [a] &lt;a href=&quot;http://lea.verou.me/2015/04/jquery-considered-harmful/&quot;&gt;ditch jQuery&lt;/a&gt;, and [b] get properly into Node / polish my JavaScript, I thought I’d &lt;s&gt;jump on the passing bandwagon&lt;/s&gt; join in, thus…&lt;/p&gt;
&lt;h2&gt;Background&lt;/h2&gt;
&lt;p&gt;Anyone who’s used jQuery or any of its clones will be instantly familiar with its &lt;code&gt;$(selector)&lt;/code&gt; syntax, which allows targetting of arbitrary elements within the DOM by CSS selector. It’s extremely powerful, and for anyone who remembers the bad old days before jQuery, makes life whole amounts easier.&lt;/p&gt;
&lt;p&gt;In recent years, similar functionality has been added to native Javascript in the shape of the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector&quot;&gt;querySelector&lt;/a&gt; and &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll&quot;&gt;querySelectorAll&lt;/a&gt; functions, the former returning a single &lt;code&gt;Node&lt;/code&gt;, and the latter a &lt;code&gt;NodeList&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;However, whilst &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/NodeList&quot;&gt;NodeList&lt;/a&gt; objects might look a little like array to the casual observer they aren’t, as anyone who attempts to use any of the new(-ish) array iterator functions will find out very quickly.&lt;/p&gt;
&lt;h2&gt;The magical invocation&lt;/h2&gt;
&lt;p&gt;Fortunately, converting from a &lt;code&gt;NodeList&lt;/code&gt; to an &lt;code&gt;Array&lt;/code&gt; is simple:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; myArray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; myNodeList &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You could even abuse Javascript’s prototype inheritance and do something like:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token class-name&quot;&gt;NodeList&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;prototype&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;toArray&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;… which would give you the ability to do this:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; myArray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.foobar&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toArray&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Those of a more Ruby-bent might prefer &lt;code&gt;to_a()&lt;/code&gt; instead, but that feels a little too much like crossing the streams…&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;While I’m writing, (another) quick note on the state of this site… which basically comes down to the usual “I either seem to have the motivation to write, or the time, but never both at the same time”. I’m trying to change this, don’t hold your breath.&lt;/p&gt;
</description>
			<pubDate>Thu, 14 Jan 2016 00:00:00 GMT</pubDate>
		</item>
		<item>
			<title>Briefly: detecting changed form inputs with jQuery</title>
			<link>https://jonpearse.net/writing/briefly-detecting-changed-form-inputs-with-jquery/</link>
			<guid>https://jdp.codes/r/nbe9dj11</guid>
			<description>&lt;p&gt;I was working on a project a few months back that required me to detect whether the user had changed the values of HTML form inputs, and prompt them suitably. After a little poking into the &lt;code&gt;defaultValue&lt;/code&gt;, &lt;code&gt;defaultSelected&lt;/code&gt; and &lt;code&gt;defaultChecked&lt;/code&gt; DOM properties, I knocked together a quick jQuery selector.&lt;/p&gt;
&lt;p&gt;It’s since worked its way into a number of other projects—this site included—so I thought I’d post it in case anyone is interested or has suggestions for improvements. Share and enjoy :)&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;/**
	 * Selector that returns form input elements that have been changed by the
	 * user since the page was uploaded.
	 *
	 * Example use:
	 *
	 *    $(&#39;form :input&#39;).filter(&#39;:changed&#39;).each(function() { … })
	 *
	 * @param   oEl     the element itself
	 * @param   index   the current loop index (unused)
	 * @param   meta    metadata about the selector (unused)
	 * @param   stack   a stack of the elements to loop (unused)
	 */&lt;/span&gt;
	$&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;expr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;changed&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;oEl&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; index&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; meta&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; stack&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token comment&quot;&gt;// 0. drop out&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; sN &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;nodeName&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sN &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;input&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sN &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;textarea&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sN &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;select&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;data-no-check&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

		&lt;span class=&quot;token comment&quot;&gt;// 1. custom hook for SELECT boxes&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sN &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;select&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token comment&quot;&gt;// a) iterate through all options. If one has changed, we&#39;ve changed&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; i &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;options&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; i&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;options&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;defaultSelected &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;options&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;selected &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
				&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
					&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
				&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

			&lt;span class=&quot;token comment&quot;&gt;// b. nothing has changed&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

		&lt;span class=&quot;token comment&quot;&gt;// 2. otherwise, for radios and checkboxen, use (default)checked&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; sType &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;type&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sType &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
			&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;radio&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
				&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; sType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;checkbox&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;checked &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;defaultChecked &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

		&lt;span class=&quot;token comment&quot;&gt;// 3. everything else uses (default)value&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;defaultValue &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; oEl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; jQuery &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At some point, I’ll get around to making it play nice with &lt;a href=&quot;http://zeptojs.com/&quot;&gt;Zepto&lt;/a&gt; as well: it’s not being picked up quite right at the moment…&lt;/p&gt;
</description>
			<pubDate>Thu, 14 Aug 2014 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>Let’s talk about shoes</title>
			<link>https://jonpearse.net/writing/lets-talk-about-shoes/</link>
			<guid>https://jdp.codes/r/eseylu74</guid>
			<description>&lt;p&gt;Nope, this isn’t a article about some exciting new framework or development methodology, I’d like to talk very briefly about footwear. In particular, the kind a shoemaker’s children are supposed to lack.&lt;/p&gt;
&lt;p&gt;Because just over a year ago, I relaunched this site with an article where I talked about Getting On With It: relaunching my website, and filling it with useful if imperfect stuff.&lt;br&gt;
I set up a wee whiteboard next my desk which rapidly filled with hastily-scribbled ideas for things I could write. I reinstalled &lt;a href=&quot;https://itunes.apple.com/gb/app/plaintext-2-dropbox-text-editing/id769101727&quot;&gt;PlainText&lt;/a&gt; on my iPad, hooked it up to my Dropbox account and created a nice directory structure into which I could dump articles. It felt good to be doing something.&lt;/p&gt;
&lt;p&gt;… all of which explains exactly why it’s taken 366 days to actually publish the next article.&lt;/p&gt;
&lt;h2&gt;Whither art thou, motivation?&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;I’ve just caught myself “but if”-ing again… which gives me an idea for a new blog post, which I might even get around to writing #motivation&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/jonpearse/status/481886432332902401&quot;&gt;@jonpearse, June 25th 2014&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;My clients have kept me very busy over the past twelve months (for which I’m not complaining at all!) and during that time, I’ve worked on a decent variety of projects. They’ve ranged from the comfortably pedestrian to the really quite overwhelmingly huge and complex. It’s meant for a few very long (100+ hour) weeks here and there, but on the whole it’s been a pretty enjoyable experience.&lt;/p&gt;
&lt;p&gt;There’s been much to write about, too, from abstract discussions of process and architecture through to the ten lines of Javascript I’d written earlier that day to solve a wee problem. A few projects have meant that I’ve been &lt;a href=&quot;http://en.wikipedia.org/wiki/Eating_your_own_dog_food&quot;&gt;dogfooding&lt;/a&gt; a fair amount recently as well, which is always good when you want things to write about.&lt;/p&gt;
&lt;p&gt;Or would be, except I’m not what one might call a natural writer. There are rare occasions where I can sit down and write, but for the most part, writing a decent non-rambling article that’s actually worth reading takes a lot of time and effort (it’s taken two hours to get this far through this article, for example).&lt;br&gt;
And for all that I might have some really interesting ideas, often I don’t have the time to sit down for several hours at a bash, but more often than not, I lack the motivation to do so.&lt;/p&gt;
&lt;p&gt;Oftentimes it leads towards the curse of ‘but if…’: periodically, I’ll tell myself that I need to write &lt;em&gt;something&lt;/em&gt;, whatever that might be, and then start thinking things that start ‘but, if…’: I could write now, but if I go change something, or do something slightly different, or have a different tool, I’ll be able to write better…&lt;br&gt;
… which, of course, is rarely the case.&lt;/p&gt;
&lt;p&gt;Ironically, the conclusion to this is pretty much the same as the conclusion to my last post—stop procrastinating, start doing. Only it turns I like ‘doing’ development more than I like ‘doing’ writing about it.&lt;/p&gt;
&lt;h2&gt;Returning to the barefoot children&lt;/h2&gt;
&lt;p&gt;I’m not going to make any promises of any kind: I have two more posts lined up, one of which is mostly written, so there might be &lt;em&gt;some&lt;/em&gt; activity here over the coming weeks. Whether or not I actually &lt;em&gt;publish&lt;/em&gt; either of them, and whether or not I publish any more following those … remains to be seen&lt;/p&gt;
&lt;p&gt;Whatever happens, when I’ve had time to spare over the past few months, I’ve been chipping away at this site in the background. For the most part the changes are fairly subtle, but they’re there.&lt;br&gt;
In no particular order:&lt;/p&gt;
&lt;h3&gt;Browser support&lt;/h3&gt;
&lt;p&gt;Previously, whilst this site worked best in a modern browser, it paid enough lip service to older browsers that it mostly worked pretty well. The most recent update does away with this, so if you’re using an older browser (in particular, IE8 and older), you’re going to get a decidedly sub-optimal experience. I’d apologise, but it’d not be sincere…&lt;/p&gt;
&lt;h3&gt;A brief diet&lt;/h3&gt;
&lt;p&gt;The lack of having to support gronky old browsers means I’ve been able to slim everything down a little, in particular I’ve completely done away with &lt;a href=&quot;http://modernizr.com/&quot;&gt;modernizr&lt;/a&gt;, which whilst awesome, is almost entirely unneeded. There is still some capability detection going on, but it’s old-school “are you IE” stuff done on the server-side to deal with IE9’s lack of flexbox support.&lt;/p&gt;
&lt;p&gt;I’ve also run the version of &lt;a href=&quot;http://fortawesome.github.io/Font-Awesome/&quot;&gt;FontAwesome&lt;/a&gt; used on this site through the amazingly useful &lt;a href=&quot;http://fontello.com/&quot;&gt;Fontello&lt;/a&gt; to remove the 380-some icons I’m not actually using. Along with a bit of CSS slimming here and there, pages are about 80–100K smaller than they used to be.&lt;/p&gt;
&lt;h3&gt;New functionality and tweaks&lt;/h3&gt;
&lt;p&gt;Due to ‘but, if…’-ing, the site now has both commenting (um, yay‽) and image galleries, both of which were blocking a couple of post ideas I’ve had.&lt;br&gt;
I’ve also been around and generally improved things all over the place: notably, I’ve changed the heading font up a little, because whilst I like &lt;a href=&quot;https://www.google.com/fonts/specimen/Lato&quot;&gt;Lato&lt;/a&gt;, it does get a little bit too much after a while. Plus, a little more &lt;a href=&quot;https://www.google.com/fonts/specimen/Karma&quot;&gt;Karma&lt;/a&gt; is never a bad thing :D&lt;/p&gt;
&lt;p&gt;I’ve also made a bunch of tweaks to the administration interface, but you’ll never see any of that…&lt;/p&gt;
&lt;h3&gt;Now 100% open-source&lt;/h3&gt;
&lt;p&gt;Actually, this isn’t anything especially new, but I saw &lt;a href=&quot;http://julieannhorvath.com/&quot;&gt;Julie Ann Horvath&lt;/a&gt; talk at &lt;a href=&quot;http://www.hybridconf.net/&quot;&gt;HybridConf&lt;/a&gt; last year about open source, and it inspired me to chuck the source code for this site up on github.&lt;br&gt;
When it comes to it, I started off in this game hacking at other people’s code to see how it works—and in fact still do—so I figured it was kinda right that I allowed others to do the same.&lt;/p&gt;
&lt;p&gt;If you’re curious, &lt;a href=&quot;https://github.com/jonpearse/jonpearse.net&quot;&gt;go take a look&lt;/a&gt;, and feel free to adapt/play/use as you see fit.&lt;/p&gt;
&lt;h2&gt;And now…&lt;/h2&gt;
&lt;p&gt;… well, we’ll see. Hopefully the next post won’t be quite so far away.&lt;/p&gt;
</description>
			<pubDate>Sat, 09 Aug 2014 01:00:00 +0100</pubDate>
		</item>
		<item>
			<title>Enough pencil sharpening</title>
			<link>https://jonpearse.net/writing/enough-pencil-sharpening/</link>
			<guid>https://jdp.codes/r/p14nc3zd</guid>
			<description>&lt;p&gt;I was tidying my flat the other day, and happened across my collection of posters taken from &lt;a href=&quot;http://www.zefrank.com/&quot;&gt;Ze Frank&lt;/a&gt;’s excellent “&lt;a href=&quot;http://youtu.be/RYlCVwxoL_g&quot;&gt;Invocation for Beginnings&lt;/a&gt;”.&lt;br&gt;
If you’ve not watched it, go ahead—I’ll be here when you’re done.&lt;/p&gt;
&lt;p&gt;As I flicked through them, one section in particular stood out:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;There is no need to sharpen my pencils any more.&lt;br&gt;
My pencils are sharp enough;&lt;br&gt;
even the dull ones will make a mark&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Whilst I usually come away from watching the video with a vague sense of “I gotta do something”, this time it stuck with me.&lt;/p&gt;
&lt;p&gt;Back in the dim and distance past, I had a website: it wasn’t much, but it was somewhere I could write about whatever was on my mind at the time.&lt;/p&gt;
&lt;p&gt;And write I did: over the several years and many forms in which the site existed, I frequently found myself writing. Sometimes it was commentary and reflection on world news, other times it would be odd bits of technical whimsy that took my fancy. Much of it, however, concerned the mundanities of a guy in his early 20s trying to find his way through life.&lt;br&gt;
Very little of it was in any way edifying, and much of it will never see the light of day again, but I &lt;em&gt;enjoyed&lt;/em&gt; it.&lt;/p&gt;
&lt;p&gt;But my life changed—I graduated university and set about finding a job. Other things happening around the same time meant I found myself writing progressively less and less.&lt;br&gt;
In addition, as time went by, some of the content on the site looked increasingly inappropriate in my new role as a professional developer.&lt;/p&gt;
&lt;p&gt;In February 2006, after months of almost complete stagnation and little motivation to do anything further, I took the site offline completely.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;I’d always planned to rebuild it: to spend time working on a new design, a better technical solution; to work on filling it with content that better suited my professional image.&lt;br&gt;
If nothing else, I realised I missed writing: I was reading blogs and magazines, going to conferences, travelling, always learning. I saw things I wanted to write about, conversations I wanted to engage with, new tricks that I wanted to share, but I lacked the platform.&lt;/p&gt;
&lt;p&gt;And there was always &lt;em&gt;Something&lt;/em&gt;. Sometimes it was waiting for that ‘perfect’ design to coalesce in my head (I’m no designer), but most of the time it was a form of technical OCD—I wanted to build it on top of my pet project, which required my pet project to be at least &lt;em&gt;reasonably&lt;/em&gt; complete.&lt;/p&gt;
&lt;p&gt;Trouble was, it never was: I’d get 70% of the way through writing it before realising I was doing it Wrong, scratching it, and starting all over. It started life in 2007 as an overly-complex CMS, and had eventually transformed into only a slightly less-complex MVC framework (christened ‘jaspr’) by the time I finally killed it last year.&lt;br&gt;
A great learning exercise, perhaps, but not one that was going to get me a website.&lt;/p&gt;
&lt;h2&gt;So what happened?&lt;/h2&gt;
&lt;p&gt;I’ve had enough.&lt;/p&gt;
&lt;p&gt;To paraphrase Ze, it’s time to stop sharpening my pencils; to stop waiting for that perfect moment of zen-like inspiration when everything Just Makes Sense. It’s &lt;em&gt;definitely&lt;/em&gt; time to stop trying to reinvent the wheel, especially when I’m trying to do so in PHP.&lt;/p&gt;
&lt;p&gt;It’s time to &lt;em&gt;just do it&lt;/em&gt;, to knock up a quick and dirty website and put it out there. Maybe it won’t be perfect, it almost certainly won’t be complete, but &lt;em&gt;it’ll be a start&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;If nothing else, I’ve been freelance for almost three years, and the lack of any form of professional web presence is starting to get embarrassing.&lt;/p&gt;
&lt;h2&gt;What now?&lt;/h2&gt;
&lt;p&gt;This site isn’t finished: in the short term, I want to add a portfolio section and turn it into a proper ‘professional’ web presence; hopefully raise my profile a little. I might even take a look at the design while I’m at it.&lt;/p&gt;
&lt;p&gt;I’m going to write—I’m not going to guarantee any kind of regularity, but as the inspiration strikes, expect to see new articles popping up on here now and then.&lt;/p&gt;
&lt;p&gt;But most importantly, I want to give back to the community: I’ve been in this game for nigh on 10 years, and in that time Google has been an invaluable part of my professional development. I wouldn’t be where I am today were it not for the thousands of blogs, magazine articles and &lt;a href=&quot;http://stackoverflow.com/&quot;&gt;Stack Overflow&lt;/a&gt; answers I’ve read over the years whilst learning new skills and puzzling over problems.&lt;/p&gt;
&lt;p&gt;Now, it’s time to give back: it’s going to be fun.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;And please god, let me enjoy this: life isn’t just a sequence of waiting for things to be done.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;For the technically curious…&lt;/h2&gt;
&lt;p&gt;The site is a quick and dirty &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Rails&lt;/a&gt; app (I am a total convert: thanks &lt;a href=&quot;http://twitter.com/seblet&quot;&gt;Seb&lt;/a&gt;), which may or may not get totally replaced at some indeterminate time in the future, and is hosted on a &lt;a href=&quot;http://www.rackspace.co.uk/cloud-servers/&quot;&gt;Rackspace Cloud Server&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;A note about browsers&lt;/h3&gt;
&lt;p&gt;I take a fairly pragmatic approach to browser support—whilst it’s nice if things look the same in all browsers, it’s &lt;a href=&quot;http://dowebsitesneedtolookexactlythesameineverybrowser.com/&quot;&gt;not essential&lt;/a&gt;. My attitude is generally that as long a site is usable and doesn’t look too horrendous, that’s just fine.&lt;/p&gt;
&lt;p&gt;As such, this site looks just fine in all decent browsers and IE9. If you’re using an older browser, you’ll notice things look a little less great, but you can still use the site just fine.&lt;br&gt;
That everything doesn’t &lt;em&gt;completely&lt;/em&gt; break in IE6+7 is a bonus and entirely unintentional.&lt;/p&gt;
</description>
			<pubDate>Thu, 08 Aug 2013 01:00:00 +0100</pubDate>
		</item>
	</channel>
</rss>
