Online communication bugs me. Actually, bugs isn’t accurate. Maybe saddens and fatigues. When volleying with people hiding behind their keyboard shield and protected by three timezones, you have to make a conscious effort to remain optimistic. It’s part of the reason I haven’t taken to Twitter as much as I probably should.
I’ve talked on this subject before and it’s something I often have in the back of my mind when reading comments. It’s come to the forefront recently with some conversations we’ve had at Western Devs, which led to our most recent podcast. I wasn’t able to attend so here I am.
There are certain phrases you see in comments that automatically seem to devolve a discussion. They include:
“Why don’t you just…”
“Sorry but…”
“Can’t you just…”
“It’s amazing that…”
Ultimately, all of these phrases can be summarized as follows:
I’m better than you and here’s why…
In my younger years, I could laugh this off amiably and say “Oh this wacky world we live in”. But I’m turning 44 in a couple of days and it’s time to start practicing my crotchety, even if it means complaining about people being crotchety.
So to that end: I’m asking, nay, begging you to avoid these and similar phrases. This is for your benefit as much as the reader’s. These phrases don’t make you sound smart. Once you use them, it’s very unlikely anyone involved will feel better about themselves, let alone engage in any form of meaningful discussion. Even if you have a valid point, who wants to be talked down to like that? Have you completely forgot what it’s like to learn?
“For fuck’s sake, Mom, why don’t you just type the terms you want to search for in the address bar instead of typing WWW.GOOGLE.COM into Bing?”
Now I know (from experience) it’s hard to fight one’s innate sense of superiority and the overwhelming desire to make it rain down on the unwashed heathen. So take it in steps. After typing your comment, remove all instances of “just” (except when just means “recently” or “fair”, of course). The same probably goes for “simply”. It has more of a condescending tone than a dismissive one. “Actually” is borderline. Rule of thumb: Don’t start a sentence with it.
Once you have that little nervous tic under control, it’s time to remove the negatives. Here’s a handy replacement guide to get you started:
See the difference? Instead of saying Sweet Zombie Jayzus, you must be the stupidest person on the planet for doing it this way, you’ve changed the tone to Have you considered this alternative? In both instances, you’ve made your superior knowledge known but in the second, it’s more likely to get acknowledged. More importantly, you’re less likely to look like an idiot when the response is: I did consider that avenue and here are legitimate reasons why I decided to go a different route.
To be fair, sometimes the author of the work you’re commenting on needs to be knocked down a peg or two themselves. I have yet to meet one of these people who respond well to constructive criticism critique, let alone the destructive type I’m talking about here. Generally, I find they feel the need to cultivate an antagonistic personality but in my experience, they usually don’t have the black turtlenecks to pull it off. Usually, it ends up backfiring and their dismissive comments become too easy to dismiss over time.
Rebecca Murphey’s talk from dotJS 2015 explores all the various gotchas surrounding HTTP/2. For instance, how will servers support it? How does our front-end process change to benefit the most from this new protocol? How will developers know that everything is working correctly?
There are people claiming that the design of your blog is not that important. Just install one of the free themes for your WordPress and you’re good to go. In the end, we all know that content is king. If you must, upload your logo but then that’s that. In fact, it’s not so simple. There is no shortage of content on the web today, and uniform blogs will have a hard time gathering enough attention to become successful for more than the usual 15 minutes of fame. Your blog needs an identity, something that immediately makes clear – this is your blog. Thus, while content certainly is king, you should still take care of a unique and grabbing design for your blog.
If you are not that skilled regarding design and layout, you should select one of the many Premium themes out there and customize it. I advise you to go for Premium because paid themes are not as widespread as free themes. Remember, we talked about making your blog unique. Invest in a cool logo and ensure that your design stands out from the crowd. Be brave and don’t run your blog just like everybody else does. That gives you a reasonable chance to be and stay noticed in that content jungle out there. To help you get going, we went ahead and curated 46 cool blog header designs for your inspiration. Here we go.
The web is often seen as a decidedly two-dimensional medium. And, to be fair, it is. That’s what it was designed for.
What’s more, the addition of three-dimensional graphics, rendered live, has traditionally required plugins. Macromedia gave us Shockwave, Unity gave us the Unity Web Player, and all the while, we’ve used 3D graphics for games, mostly.
HTML5, CSS3, and some inventive JavaScript have done a lot to change this, however. Oh, it’s still mostly used for games, but you can take it further, and integrate the graphics into a regular site more easily than ever.
Sure, we still have usability concerns. A site that depends on 3D graphics for navigation or essential content is still a terrible idea. However, when used with progressive enhancement, 3D is a viable, and even performance-friendly way to take things up a notch.
voxel.css is a framework that uses CSS3 to do the heavy lifting of rendering 3D objects. JavaScript is used to add interactivity, trigger the animations, and pretty much everything else.
Style
Well, this is CSS we’re talking about. You’re not going to get Crysis-level graphics. As the name of this framework suggests, what you get is a lot of cubes. Think Minecraft in the browser. (And someone will build a Minecraft clone with this in three… two…)
Still, you can do some impressive things with blocky graphics. Think of it as taking 8-bit art to a whole new level.
Easy 3D rendering
The basic implementation of voxel.css only requires the inclusion of the library, and 15 lines of code. This creates a savable virtual scene where you can edit your models, point-and-click style.
You can then display these scenes to any web page, and animate them as desired.
Use any image type for textures
Use a PNG for transparency, a GIF for animation, or an SVG file for unlimited scalability. Use a JPG for reasons unknown, or the WebP format because you like things that aren’t implemented in all browsers yet.
Again, it’s CSS3. You can use the superior rendering power of a device’s graphics card (or chip, as the case may be) to display your work. You won’t have to worry about choppy graphics on anything but the slowest of mobile devices. (You should be using a fall-back for those in any case.)
Conclusion
voxel.css is a simple, no-nonsense way to get some three-dimensional goodness into your web app, page, site, or game. Try it out, look at the demos, and see if it’s right for your project.
The following is a guest post by Charlie Walter. Charlie has written for us before and is back to share something completely different. We’re going to learn about methods he’s learned for streamlining WordPress theming using templating engines.
Templating engines are fantastic! They make complex programming languages much easier to write and include features that streamline the development process.
WordPress is a natural environment for us to see how templating engines work, not only because it’s template-driven, but because of its reliance on PHP. WordPress itself is lauded for its low barrier to entry for content publishers, but the knowledge of PHP that it requires for heavy customizing makes it a somewhat higher bar for developers wanting to get into the game beyond basic theming.
How Templating Engines Work
At its most basic, a templating engine is a package that is included in a project that allows us to compile one language into another.
I liken it to foreign language proficiency. Yes, you took four years of Spanish instruction in high school, and you might be able to read and write it on a decent level, but it’s still very hard to put a complex string of words together. If you had an app on your phone that could take your Spanglish and translate it into beautifully composed Spanish, that would be akin to what a templating engine does for PHP.
Let’s look at the basic example of the WordPress loop in vanilla PHP:
…and the same, but with shorthand written in Twig:
{% for post in posts %}
<article>
<h1>{{post.title}}</h1>
{{post.excerpt}}
</article>
{% else %}
<p>Sorry, no posts matched your criteria</p>
{% endfor %}
If that doesn’t deserve a happy sliding penguin, then I don’t know what does.
Different Templating Examples for WordPress
I am going to run through several templating engines that can be used to make WordPress theme development that much more fun to write. In each case, we’ll give an overview of the templating engine itself, an example of how it can be used with the WordPress loop, then resources for plugging them into WordPress.
Jade-PHP makes it possible to write PHP in Jade files.
Wait! What’s Jade?
Jade is a clean, whitespace-sensitive syntax that is an HTML templating engine in its own right. So, for example, this …
.my-class
a.btn(href="http://charliejwalter.net/") I'm a link
… compiles into this:
<div class="my-class">
<a class="btn" href="http://charliejwalter.net/">I'm a link</a>
</div>
While Jade itself is an abstraction of HTML, Jade-PHP allows us to abstract PHP in alongside HTML making it an ideal fit for WordPress theme development.
The Setup
WordPress templates are written in and saved inside .jade files. Using Grunt and the grunt-jade-php task, we can compile Jade files (.jade) into the PHP files (.php) WordPress requires to do its thing.
The Jade templates are a one-to-one relationship with WordPress templates. In other words, where WordPress has a page.php file for the default page template, we would include a page.jade file in our directory that our Grunt task will translate into the PHP file. WordPress will then use the compiled PHP files as if we had written the PHP inside of it, though we never had to touch PHP at all. Pretty rad!
Note: These PHP files need to be where you usually put them.
One downside is we have to compile our Jade to PHP locally and, when that happens, Jade-PHP churns out a full HTML document for each template rather than using WordPress methods like get_header() and get_template_part() to re-use templates. This isn’t a problem for maintenance, but in terms of performance, we would be loading code that could have been cached.
The way I structure my files personally is to create both source and compiled folders in my project to keep all the source files separate from the compiled versions. The compiled folder is what WordPress will actually use as the theme. However, files that don’t need compiling will need to be copied into this compiled folder. This can be done with grunt-contrib-copy. It also means we can watch these files and hook into livereload to refresh our work on the fly!
WordPress will try to read the source folder as another theme, which will prompt an error message along the lines of “Template is missing” since it cannot locate all the files needed to construct a complete theme. Not ideal, though you could theoretically exclude the source files in the deployment process to prevent that sort of message from popping up.
One thing to note about Jade-PHP is the lack of specific syntax highlighting for Atom, Sublime or TextMate, at least at the time of this writing. That could be a deal-breaker for some.
The WordPress Loop in Jade-PHP
:php
if (have_posts()) :
while (have_posts()) : the_post();
article
h1: a(href= the_permalink())= the_title()
p= the_excerpt()
endwhile;
I always find building WordPress themes terribly messy because of how tough it is to make PHP and HTML look good together in the same markup. We can use Jade on its own to help with the lifting. The primary difference here from Jade-PHP is that our assets will be compiled server-side. That means there is no local compiling needed because it will happen on the fly as the templates are accessed. Plus, that solves the issue of templates compiling into full HTML documents, allowing us to take advantage of Jade’s more advanced templating features, such as extending one template into another.
The Setup
First off, we need the Jade compiler for PHP, which can be found in the Jade repository on GitHub under the “Implementations in other languages” section.
Then, let’s create the composer.json file in our theme folder:
Now, run the Composer installation. If your Composer installation is global that would be:
composer install
Or, If composer is installed locally in the project:
php bin/composer install
Now, we need the following templates in our theme directory:
compiler.php
page-data.php
layout.jade
functions.php
index.php
Note: All WordPress themes require style.css as well, but we’re leaving it out of this and other lists because it has no bearing on getting started with our templating engines.
compiler.php
This file takes care of returning the Jade compiler into your templates by requiring it everywhere.
<?php
require_once('vendor/autoload.php');
use JadeJade;
return new Jade();
?>
page-data.php
This is for common page variables we want to make available for reuse.
<?php
$data = array(
'wp_title' => wp_title('', false),
'wp_head' => output_buffer_contents(wp_head),
'wp_footer' => output_buffer_contents(wp_footer),
'template_directory_uri' => get_template_directory_uri(),
'stylesheet_url' => get_bloginfo('stylesheet_url'),
'home_url' => esc_url( home_url( '/' ) ),
'blog_title' => get_bloginfo(),
'pages' => get_pages(),
'categories' => get_categories('show_count=0&title_li=&hide_empty=0&exclude=1')
);
// To compensate for WordPress not providing a url for each post
foreach ( $data['pages'] as $page ) {
$page->permalink = get_permalink($page->ID);
}
// To compensate for WordPress not providing a url for each category
foreach ( $data['categories'] as $category ) {
$category->link = get_category_link( $category->term_id );
}
return $data;
?>
layout.jade
Extending templates into others is a huge benefit to Jade. This allows us to create a shell that can be used as the primary building block for our site layout, then modify it as it’s extended.
This could could be just about anything, but could look something like this:
Most WordPress themes make use of a functions.php file. In this context, we are adding a function to it to compensate for the lack of a get_wp_head() method:
This is the primary template or homepage in most WordPress theme directories. Here is a working example of index.php that includes the Jade compiler and page data:
Here, the familiar WordPress loop is used but, rather than rendering the markup within the loop, we add properties to a posts array on the page $data where we want Jade to compile and populate the content.
The WordPress Loop in Jade
Here’s the WordPress loop, in Jade:
each post in posts
article
h1
a(href= post['permalink'])= post['title']
!= post['excerpt']
I mustache you a question: do you want less logic in your templates? Mustache offers a logic-less approach to templating, which forces you to keep the logic separate from the templates, which effectively declutters them. Bonza!
The Setup
The set up is very similar to how we render the Jade templates. in that the compiler for it can be installed using Composer.
First off, let’s create the composer.json file in our theme directory:
{
"require": {
"mustache/mustache": "~2.5"
}
}
Run the Composer install and, just like that, we can add the following to our WordPress page templates to ensure the compiler runs:
echo $mustache->render('index', $data);
Now that we’re armed with Mustache, we need to add a mustache-compiler.php file to our theme folder in order to require the compiler to load in our templates, and to do so without needing to specify an explicit path to the views folder where our sources file will reside:
<?php
require_once('vendor/autoload.php');
return new Mustache_Engine(array(
'loader' => new Mustache_Loader_FilesystemLoader(get_template_directory() . '/views')
));
?>
So, you like the ideas shared in this post so far but might not want to go through all the setup. This is where Timber comes in.
Timber is available as a free WordPress plugin, making it perhaps the easiest to install of the templating engines we’ve covered here. In fact, Timber itself isn’t the templating engine, but rather relies on Twig for that while acting as the configuration needed to write Twig files. Plus, it boasts a library that integrates WordPress hooks into Twig making it every bit as powerful as writing native PHP in WordPress.
Oh yeah, and we have an article that covers the ins and outs for getting started with Timber.
Next up, we’ll need to make sure our theme directory includes the following files:
layout.twig
functions.php
index.php
layout.twig
This will be the primary chunk of markup for our site that includes the document and the basic layout of the site. In other words, we can extend it on all of our Twig template files and change out certain blocks on a template-by-template basis.
Here’s a basic example using a pretty common site layout:
Anything wrapped in double braces {{ }} are variables that Timber will fill in with the compiled output from Twig. And, when we extend this template into other templates, we will be able to modify each variable directly in the template where it is extended.
functions.php
This is the same standard file that comes packaged with most WordPress themes. What we’re adding to it are instructions for how Timber is configured, as well as definitions for any variables we call in our templates.
<?php
add_filter('timber_context', 'add_to_context');
function add_to_context($data){
$data['menu'] = new TimberMenu();
$data['categories'] = Timber::get_terms('category', 'show_count=0&title_li=&hide_empty=0&exclude=1');
return $data;
}
?>
index.php
This is often the primary or homepage template of a WordPress theme. We need to call the variables we defined in functions.php so the template knows what to render when Timber compiles the Twig files to PHP. In this case:
While Timber includes one templating engine out of the box, we can configure it to use something else in addition to Twig. It might seem silly to use two templating engines together but, if you like the features that Twig offers and prefer writing code in Jade…well, we can do that!
The Setup
We’ll be using the standard Timber configuration but compile Jade locally into Twig. People compile Jade into another other syntaxes with AngularJS all the time so why not do it Timber as well?
Once again, WordPress will attempt to load the source folder as its own theme unless we exclude it during deployment.
See that funny .twade extension? Those are just Jade files that get compiled (locally with Grunt) into .twig files that—you guessed it—are read by the .php files and compiled into PHP server-side.
The WordPress Loop in Timber + Jade
each post in posts
article
h1
a(href= post['permalink'])= post['title']
!= post['excerpt']
Alternative to the above, we can bypass Twig altogether to marry Jade’s templating features with the simplicity of Timber’s setup and feature-rich library. This is exactly the same setup as Timber, but intercepting Timber::render with this in our index.php instead:
Templating engines are fantastic and work great with WordPress. It is purely a matter of preference as far as which one works best for your skill set and the website you are building.
Sites that require lots of complex views may benefit from an engine that offers more logic in the templates like Timber or Jade. Seasoned PHP developers might prefer to Mustache for its ability to keep all the logic on the server.
I’ve set up starter themes for all of the options written in this post. Please feel free to use them to get the ball rolling on your own projects, or just to experiment:
Sketch has recently announced the release of Sketch 3.5, its latest major update that comes with many enhancements and bug fixes, especially in the domain of rendering and performance. Plus, Sketch 3.5 has shortly been followed by a small bug fix, Sketch 3.5.1
Here is what Sketch 3.5.1 has to offer:
Better rendering performance
Better caching for multiple blended layers
The title of the Artboard now truncates, if too long
Sub-pixel anti-aliasing has now been turned off by default
You can now export slices in SketchTool using their ID
Several bug fixes and other improvements.
This update is free for users with a valid Sketch license, though if you have not already done so, you will need to transition your license, because Sketch is no longer available in the Mac App Store and can now only be purchased from its own site.
Sketch 3.5 requires Mac OS 10.10 or higher to run. Furthermore, as always, Sketch 3.5 files will not be backwards compatible with older versions of Sketch.
Sketch 3.5.1 fixes one minor bug that showed an error when importing PDF or EPS files copied via Illustrator.
2015 witnessed a lot of changes and innovations, but 2016 has a lot more in store. With more people accessing the Internet via mobile devices than desktop computers, a sharp and continued decline in human attention span, and web users becoming increasingly impatient, the web design community is in for a treat this year.
If you are a web designer, or even if you have a website, you should pay attention to the following trends in 2016:
1. User-centered design
Research from Nielsen Norman Group shows that the average user spends 10 – 20 seconds on a web page before leaving, and that the only way to improve this is by having a clear value proposition. Interestingly, this also agrees with Google’s position when they released their Search Quality Rating Guidelines late 2015; one of the highlights of Google’s Quality Guidelines is that having content front and center is now a big deal: essentially, content that is placed above the fold will be ranked better than content that is hidden below ads, forms and other elements.
As we can see, whether it is in terms of users’ response or search engine algorithms, the importance of a user-centered design has never been clearer; in 2016, only websites with a user-centered design will thrive.
2. Expect to see more of Material Design
Material Design was initially announced by Google in 2014, as a design language that uses shadow effects, responsive animations and grid-based layouts to create a realistic design with a focus on UX.
For a very long time, adoption of Material Design has been limited to app design until Google announced Material Design Lite (MDL) in 2015; the aim was to make it easy to add a material design look and feel to your website.
Because of its focus on creating a minimal and realistic look, while still ensuring websites are fast and responsive, you can expect to see more of Material Design in 2016.
3. More of single page design
There’s so much clutter online today, which doesn’t seem to be dying anytime soon, and this has given rise to the popularity of minimalist designs; when we consider decreasing attention spans, increasingly impatient web users and a renewed desire for instant gratification, single page designs will gain more attention this year.
People no longer want to scroll through multiple pages, and many websites are keying into this by having a single-page design; a notable example is the World Food Clock website.
Single page designs work both in terms of UX and conversion, so you can expect to see more of single page designs in 2016.
4. Modular Design will become increasingly prominent
The average media site publishes dozens of articles every day, and content-rich sites have always struggled with organization; Modular Design solves the problem of clutter by making content more presentable using a block grid pattern.
Modular Design showcases more content while avoiding clutter, so you can expect to see more sites, especially media sites, jump on the bandwagon this year. A good example of a major publication that uses modular design is The Next Web.
5. SVG
Scalable Vector Graphics (SVG) became more prominent in 2015; even Google redesigned its logo to a cleaner, smaller SVG file. SVG is becoming more mainstream because it presents graphics as vectors that can scale irrespective of the resolution of the device they’re viewed on. It also makes it easy to create animated and interactive graphics, a feature that is becoming more important in an increasingly visual world.
The fact that pretty much every browser now supports SVG will further help its adoption, so expect to see SVG go mainstream in 2016.
6. Responsive web design
Okay, so responsive web design has been a trend for at least a few years now, but even more so in 2016!
For a long time, website owners have known of the power of responsive web design but they haven’t taken it as seriously until now; a major force in the increased adoption of responsive web design was the “Google Mobilegeddon” in 2015. Basically, this was Google’s attempt to ensure that websites adapt to mobile best practices, when it began to penalize websites that were not mobile-friendly. Many established sites suffered major loss, and they had to choose between having a mobile site/theme and going with a responsive design. This trend will continue in 2016, and you can expect to see more of responsive designs.
7. Widespread adoption of micro-interactions
Micro-interactions are contained product moments that revolve around a single use case. Web users encounter micro-interactions every day; when you update your status, or ‘like’ something, you are engaging with micro-interactions. Micro-interactions can create a better experience for users by enhancing their experience on a site, and its one more trend we can expect to see more of in 2016.
8. Speed is no longer a luxury; it’s a necessity!
In 2016, more than ever before, speed will play a major role: brands that ignore speed will suffer severely, as people are becoming increasingly impatient. This is very important for both website owners and designers.
A Microsoft study conducted in 2015, which studied 2112 people, revealed that our attention span has decreased massively over the years; from an attention span of 12 seconds in the year 2000, we now have an attention span of 8 seconds.
For a very long time, speed and usability have always gone hand in hand and this is becoming increasingly pronounced in 2016; research shows that slow websites cost the U.S. economy over $500 billion annually, and that 40% of people will abandon a website that takes longer than 3 seconds to load. Speed is a core part of design, and it’s a force website owners have to reckon with in 2016.
Brad Frost has made a very interesting visualization tool that helps teams think about performance budgets. It shows all the assets (HTML, CSS, JS, images, fonts, etc) as part of one proportional bar chart. It’s a great way to look at it, because it reinforces the idea of “increase one, others need to shrink”.
Nadav Soferman has written a great post about the common mistakes that can be made when developers attempt to make images responsive:
Whichever responsive design solution or framework you choose, you still need to generate and deliver multiple versions of each image. The challenge of finding the best fitting resolutions, which are the responsive breakpoints for each specific image, is common for all approaches and frameworks.
What’s especially surprising to me is we need to serve a different number of scaled images depending on the image itself in order to get the best performance gains possible. One image might require five versions whilst another might require nine.
Nadav also walks us through a new tool called Responsive Breakpoints which has been designed to solve a lot of these common mistakes. If we upload an image the app will let us download the scaled-down images, show us which are the optimal breakpoints for that particular image, and will then give us a clear example with markup so that we can add it straight into our designs.
This tool handles the image creation and srcset attribute creation, but I’ve also dreamed of an automated tool for sizes attribute creation. For example, the page you intend to use the image on loads up in an iframe. The iframe resizes around a bunch, watching what happens to the width of the image and recording the dramatic shifts (which are likely breakpoints). Then it intelligently creates the sizes attribute based on that information. #HotAppIdea. Which also reminds me of how nice it would be to set a tag with sizes information, since designs change.
The internet is a wonderful place (mostly). An unprecedented revolution in communication, it continues to empower more people to publish and share their knowledge than any other phenomenon in history. It is a limitless playground of ideas and unbridled creativity. Or is it?
In 2014, Elliot Jay Stocks declared that designers have stopped dreaming. That we’ve stopped being creative. That every site looks the same. A crazy notion, considering the magnitude of tools and resources we have at our disposal. But Elliot’s been right before, and he’s not alone either.