Entries by admin

Symfony Flex: Paving the Path to a Faster, Better Symfony

Original Source: https://www.sitepoint.com/symfony-flex-paving-path-faster-better-symfony/

Symfony Flex is a modern replacement for the Symfony Installer, and not the name of the next Symfony version. As the intro text says:

Internally, Symfony Flex is a Composer plugin that modifies the behavior of the require and update commands. When installing or updating dependencies in a Flex-enabled application, Symfony can perform tasks before and after the execution of Composer tasks.

The new Symfony will be called just Symfony 4, and while this tutorial will deal only with the Flex tool, it will mention some Symfony 4 upgrades as well.

Still Under Development

Symfony Flex can be considered a Composer wrapper, in that it provides your Symfony project with additional options during installation and configuration. It was developed with simplicity in mind, and obviously heavily influenced by the user-friendliness of Laravel. Remember, Laravel got to its current level of popularity due to its ease of use and the low entry barrier it provides newcomers with, and Symfony wanted to emulate this.

It should be noted that both Flex and Symfony 4 are still under development, slated for release somewhere at the end of November this year (2017). As such, some of the features mentioned in this post may have changed by the time you read it, but we’ll do our best to keep it up to date.

Most notably, the use of a makefile and the make tool to build a project if Symfony/Console is unavailable is still up in the air, as it seems to not be working properly on some operating systems. Fabien recently held a survey around this, asking for the community’s suggestions to a replacement, and overwhelmingly, the community voted in favor of just making Symfony/Console required.

Survey result

What’s Different?

Most notably, Flex respects the coming Symfony 4 updates which boil down to the following major changes:

PHP 7+ is required
all folders are optional. If your project isn’t using one, it doesn’t have to be there. This makes the directory tree much simpler and more readable. Additionally, often useless files like .htaccess, LICENSE, and README have been removed as well – a project which needs those can easily add them.
there is no more web folder. Instead, there is the public folder, like in all other major frameworks. This consolidates user experience across ecosystems.
temporary files go under /var in the root of the project folder, with the /var/cache subfolder reserved for long term cache, like merged class files for deploying apps as read-only artifacts
source code goes under /src. No /app.
configuration goes into /config.
templates go into /templates.
Flex will have its own Symfony-verified list of packages that are referenced by one and one alias alone. So executing composer require cli will actually trigger Flex, which will look in its list of packages, find the one tagged as cli (in this case, Symfony Console), and install it. These “official” packages are called recipes, and can be found here. To accept user-submitted recipes, a flag exists in Flex’s configuration which needs to be set to true: composer config extra.symfony.allow-contrib true. Those recipes can be found here. By officially endorsing some packages, Symfony is in many ways becoming as opinionated as Laravel. While this is bad in some ways, it’s very good in many more ways: a consolidated, opinionated way to build Symfony apps used by most people so that everyone is on the same page.
bundle fragments no longer need to be custom-activated and added into a ton of files. Flex automates this, as well as their removal.
instead of parameters in config files, Symfony 4 will be using environment variables like Laravel

Bootstrapping

As usual, we’ll assume you’re already running a healthy VM environment like Homestead Improved so you can follow along.

Okay, let’s get our hands dirty with an example app. All Symfony apps can now be started from the bare bones super-minimal Symfony Skeleton app:

composer create-project symfony/skeleton flexy

Notice the created directory structure.

Directory structure

In /public, we no longer have app.php and app_dev.php, only the index.php file. The type of the environment (test / dev / prod) is now dictated with environment variables, and reads the configuration from the /config folder.

Notice how the end of the installation process mentions that make cache-warmup was called, and that you can run make serve. This is where the new Symfony uses the “controversial” Makefile approach mentioned above. This might change.

Out of the box, opening this skeleton in the browser will throw an error because no routes have been defined yet. Let’s fix this.

index:
path: /
defaults: { _controller: ‘AppControllerDefaultController::index’ }

config/routes.yaml

We’ll need to create this controller and its index action:

<?php

namespace AppController;
use SymfonyComponentHttpFoundationResponse;

class DefaultController
{
public function index()
{
return new Response(‘Hello’);
}
}

This will produce a simple Hello screen, like so:

Hello Symfony

Execution Permissions

If you try to install a binary like the Symfony/Console with composer req cli, you might run into the following problem:

~ bin/console
-bash: bin/console: Permission denied

This is a known hiccup when using virtual machines, and can be easily fixed by either:

running the console with php bin/console instead of running it directly, or
adding the “execute” permission to the file on the host machine (not from within the virtual machine), by executing: chmod +x bin/console. This will allow the direct execution of bin/console from within the VM then.

Continue reading %Symfony Flex: Paving the Path to a Faster, Better Symfony%

12 Best Web Design Podcasts

Original Source: https://www.webdesignerdepot.com/2017/10/12-best-web-design-podcasts/

The best way to keep up with industry news is through podcasts. So much happens on a monthly basis and keeping a list of the best podcasts can help you stay on top of major industry changes.

We’ve curated some of our top picks here with a nice variety of topics. These podcasts offer a mix between frontend web development topics along with more UI/UX design topics for visual designers.

1. Developer Tea

If you’re big into development then you’ll want to bookmark Developer Tea. Episodes can vary in length from 15-20 minutes up to an hour but the content is always superb.

New episodes come out every couple days so it’s one of the most up-to-date podcasts you’ll find. Developer Tea follows ideas in web development beyond just coding such as web optimization and security.

But even newbie developers can find a lot of great tips in here with advice for coding bootcamps and handy learning resources. Well worth checking out especially due to the volume of content.

2. Front End Happy Hour

The world of frontend development is always expanding with new libraries and hot new tools. Front End Happy Hour is a weekly podcast updating listeners on the happenings in the web dev world.

Anyone who builds websites should really study frontend development first. It’s the gateway to building great websites and it’s much simpler than backend development which has so many different languages to pick from.

And if you’re just getting into frontend dev work then Front End Happy Hour is sure to entertain.

This podcast is very laid-back so it feels like a friendly conversation rather than business talk. Certainly a more appealing style for devs who enjoy ramblings and opinions along with dev convos.

3. ShopTalk

The ShopTalk Show is a wildly popular podcast hosted by web legends Dave Rupert and Chris Coyier. It’s also a weekly podcast with some really interesting topics that delve pretty deep into modern techniques.

Chris actually founded the well-known CSS Tricks website and he also helped create the online IDE CodePen. You’re in good hands with these two hosts as they wax on about browser quirks, new W3C changes, and the future of the web.

I recommend this for pretty much anyone who runs or manages websites.

It does have a technical barrier to entry so if you aren’t a developer many of these episodes will go right over your head. But the topics are super insightful so you’re bound to learn something along the way.

4. Style Guides Podcast

Corporate brands and company websites all need style guides. These are essential for keeping the same look and feel over many pages and building a consistent design across many mediums (ads, landing pages, mobile apps).

The Style Guides Podcast is actually hosted on the awesome StyleGuides.io website. This site curates a bunch of style guides along with design assets, tips, tutorials, and books covering the process of designing great style guides.

Naturally the podcast is just one more amazing resource for anyone who wants to learn about this process.

Currently in season 2 this podcast offers close to 20 episodes (and counting) with a bunch of talented designers. It’s a niche resource but incredibly valuable for anyone studying style guide design work.

5. Responsive Web Design Podcast

Here’s another niche podcast focusing on responsive web design and how it’s changing each year.

If you do any frontend dev work I highly recommend the Responsive Web Design Podcast. It’s hosted by two industry pros Karen McGrane and Ethan Marcotte, both of whom have extensive knowledge in this area.

Ethan literally wrote the book on responsive web design so you know this is a podcast you can trust. Some episodes talk about trends in the industry, others bring on guests like this episode with the Salesforce team.

Either way this is the de-facto resource for RWD and modern web design in general. It’s great for designers but especially valuable for developers.

6. CodeNewbie

Looking to get into the web dev scene but unsure of where to start? There are tons of free resources to help you learn but it also helps listening to others’ paths breaking into this space.

CodeNewbie is a podcast dedicated to interviewing coders and talking about their journey into the field. It updates roughly once a week with interviews from programmers, frontend developers, and other tech-oriented folks who’ve made coding a career.

Some episodes offer more advice for beginners while others talk about specific subjects like website load time and web accessibility. Each episode is a goldmine for newbies just getting into web development.

7. Motion And Meaning

Val Head and Cennydd Bowles host the fast-growing web UX animation podcast Motion And Meaning.

Both Val and Cennydd have a long track record of incredible design work and they’re experts on the topics of animation, microinteractions, and how these tie into the user experience.

Each episode usually has a special guest who joins to discuss a specific topic in detail. This topic can be general motion graphics or specific techniques like mobile UX prototyping.

If you have any interest in motion design or animation for the web then you’ll find a lot of value in this podcast.

8. CTRL+Click Cast

For something a little more general check out the CTRL+Click Cast. Lea Alcantara and Emily Lewis host each episode with special guests and tips for everything web-related.

Most episodes follow trends in web development with topics on workflow tools like npm and tech stacks. But you can find plenty of episodes on more general web concepts like the mobile web and more design-oriented trends.

This podcast dates back to 2009 so it’s been online for almost a decade. It’s gotta be one of the oldest web-related podcasts and each new episodes delivers even more value.

9. Let’s Make Mistakes

Let’s Make Mistakes is a general design podcast covering ideas beyond just the web. Although it does focus a lot on web design it’s also a podcast for anyone who loves digital design work.

This is another very casual show and it’s not 100% business all the time. You’ll certainly learn a lot but it’s also a podcast for listening to personalities and soaking up design culture.

Totally worth checking out if you’re into digital design or looking to get into it.

10. Non Breaking Space Show

The Non Breaking Space Show brings on a new guest every week related to web design.

It’s been running since 2012 so there’s a long list of episodes to go through. But since the web advances so fast it’s best to stick with episodes from the past 1-2 years (unless you find a guest you love!)

Most topics revolve around web development which can include SVG work, accessibility, APIs, and JavaScript advancements. If you’re into coding then you’ll dig these incredible guests but this may not be as useful to non-techie listeners.

11. Design Life

On the flip side Design Life is very much a designer’s podcast. It’s hosted by two digital designers Charli Marie and Femke who share their thoughts on design industry news, landing jobs, creating portfolios and other related tips.

This is a true design podcast so it’s absolutely stellar for anyone who loves the design side of things.

New episodes come out on a weekly basis and they date back to 2016 so there’s a sizable archive to go through.

12. JavaScript Jabber

JavaScript Jabber is the best resource for picking up tips on JS coding and related libraries.

Each episode brings on a new guest and topics range from Node to Vue.js and even lesser-known JS APIs.

In case you couldn’t tell by the title, this is pretty much 100% JavaScript focused. You should already have experience with JavaScript before listening to these episodes or you’ll wind up lost and confused.

But for developers who can’t get enough JS highlights the JavaScript Jabber podcast is always a great listen. They even have a suggestion page if you wanna toss out topic ideas for future episodes.

           

Sweeten Up Your Typeface Toolbox with Chocolates Condensed – only $9!

Source

p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}

From the Ashes: Beautiful Art Benefits California Wildfire Relief funds

Original Source: http://feedproxy.google.com/~r/abduzeedo/~3/CFkmfkNoF1o/ashes-beautiful-art-benefits-california-wildfire-relief-funds

From the Ashes: Beautiful Art Benefits California Wildfire Relief funds

from the ashes

ibby
Oct 13, 2017

If you’ve been following the horrific wildfires ravaging our beloved wine country here in California you may enjoy a moment to take in a small piece of positive news proving art can really rally a movement for good. Enter the amazing husband/wife duo Eric Rewitzer and Annie Galvin, the founders of printmaking workshop 3 Fish Studios located in San Francisco’s Sunset District. Annie created a lovable watercolor print of a California poppy rising from the ashes to pay homage to the victims of this heart-wrenching natural disaster while also doing their part to contribute to the relief effort. Through today, ALL proceeds of 3 Fish Studios iconic I LOVE YOU CALIFORNIA collection will go to support relief efforts for those affected by the California wildfires. 3 Fish have also just released a set of inspirational cards, printed on donated 16-point card stock featuring the “rising from the ashes” print. The four-card packs ($10) will also benefit ongoing relief efforts. An inspiring story from an inspiring couple doing their part to make a difference through art. 

I love you California

From the Ashes

from the ashesABOUT 3 FISH STUDIOS

Eric Rewitzer and Annie Galvin are printmakers and painters, husband and wife, and founders of 3 Fish Studios. The Outer Sunset hub is home to their workshop and studio, where art happens daily and visitors are always welcome; they love collaborating, making, and sharing creative projects with cool folks.

Annie was born and raised in Ireland. She worked as an illustrator in a Dublin agency before moving to San Francisco in 1989, two weeks before the earthquake.  Annie is inspired by San Francisco, Vogue magazine, comic books, Josef Frank textile designs, gardens, Mexican wrestlers, the short stories of Haruki Murakami, and her own dreams and daydreams. She doodles constantly.

Eric was born and raised on the industrial shores of Lake Michigan. He studied at the Cleveland Institute of Art, and moved to the west coast in 1987. Eric finds constant inspiration in the scale and diversity of the the California culture and landscape, and will forever love the mix of natural beauty, urban grit, and human diversity on display in San Francisco.

Annie and Eric met in Berkeley in 1998, were married in 2001, and started 3 Fish Studios in 2007. From its original space in the Dogpatch to its now permanent place in the Ocean Beach Republic, the pair have created a dedicated space where they can make and show their work together, and invite people—neighbors and newbies alike—to do the same. 

 

watercolor
3 Fish Studios
california wildfire


How to master colour theory

Original Source: http://feedproxy.google.com/~r/CreativeBloq/~3/ag5mUpLgq3k/colour-theory-11121290

Colour is such a pervasive part of everything we visually encounter in the world, that for many designers it becomes an intuitive choice. If you think back to school though, you'll recall being told at a young age that there are three 'primary' colours – Red, Yellow, and Blue. We were all taught that any colour can be created by mixing these three colours in varying quantities.

It turns out that this isn't quite right (although it's still workable enough in practice to be taught the world over to five-year-olds).

Get Adobe Creative Cloud
How colour is formed

Colour theory: image 1

Colour theory stretches back to at least the 15th century

Understanding how colour is formed and, more importantly, the relationships between different colours, can help you to use colour more effectively in your designs.

The Bauhaus school understood this in the 1920s and 1930s, with staff and students going on to develop colour theories for evoking particular moods and emotions through choice of palette in design and architecture.

The theory of colour is a discipline that stretches back much further than that – at least to the 15th century – and encompasses physics, chemistry and mathematics to fully define and explain the concepts. However, much of this is unnecessary to being able to use colour effectively. 

This quick primer will give you a handy overview of all the important aspects to help you start making informed decisions.

Colour systems

There are two primary colour systems – methods by which colour is reproduced: additive and subtractive (also known as reflective). We use both on a daily basis – the screen you’re reading this article on uses additive colour to generate all the colours you see, while the book you’re reading uses subtractive colour for its front cover.

In simple terms – anything that emits light (such as the sun, a screen, a projector, etc) uses additive, while everything else (which instead reflects light) uses subtractive colour.

01. Additive

Colour theory: RGB

Additive colour is based on red, green, and blue – RGB for short

Additive colour works with anything that emits or radiates light. The mixture of different wavelengths of light creates different colours, and the more light you add, the brighter and lighter the colour becomes.

When using additive colour, we tend to consider the building block (primary) colours to be Red, Green, and Blue (RGB), and this is the basis for all colour you use on screen. In additive colour, white is the combination of colour, while black is the absence of colour.

02. Subtractive

Colour theory: CMYK

Subtractive colour is based on cyan, magenta, and yellow

Subtractive colour works on the basis of reflected light. Rather than pushing more light out, the way a particular pigment reflects different wavelengths of light determines its apparent colour to the human eye.

Subtractive colour, like additive, has three primary colours – Cyan, Magenta, and Yellow (CMY). In subtractive colour white is the absence of colour, while black is the combination of colour, but it’s an imperfect system.

The pigments we have available to use don’t fully absorb light (preventing reflected colour wavelengths), so we have to add a fourth compensating pigment to account for this limitation.

We call this “Key”, hence CMYK, but essentially it’s black. Without this additional pigment, the closest to black we’d be able to render in print would be a muddy brown.

The colour wheel

Colour theory: Colour wheel

The modern colour wheel has been in use since the 18th century

In order to make it easier to see the relationship between different colours, the concept of the modern colour wheel was developed around the 18th century. These early wheels plotted the different primary colours around a circle, mixing different primary colours together in strict ratios to achieve secondary and tertiary colours.

The colour wheel allows us to see at a glance which colours are complementary (opposite each other on the wheel), analogous (adjacent to each other on the wheel), triadic (three colours positioned at 120 degrees on the wheel from each other) and so on.

Each of these relationships can produce pleasing colour combinations. There are many more pleasing relationships between colours based on their position on the wheel. There are free apps for picking a colour scheme, or you could use your designer's eye to pick your own. Click through to the next page for a little help on this.

Next page: the three components of colour, colour gamut, and more…

The three components of a colour

Colour theory: Hue saturation

The three component parts that help us define a colour are hue, saturation and brightness

Yellow is yellow is yellow, right? Well, actually, no; there are many different colours we could refer to as yellow. Different shades or tints, saturations and hues are all possible while still being within the yellow part of the colour wheel. As a result, there are three primary component parts that help us define a colour:

01. Hue

This is the position on the colour wheel, and represents the base colour itself. This is typically referred to in degrees (around the colour wheel), so a yellow colour will appear between 50 and 60 degrees, with the perfect yellow appearing at 56 degrees. Green, meanwhile, appears at 120 degrees on the wheel at so on.

02. Saturation

This is a representation of how saturated (or rich) a colour is. Low saturation results in less overall colour, eventually becoming a shade of grey when fully desaturated. Saturation is normally referred to as a percentage between 0 and 100%.

03. Brightness

This is how bright a colour is, typically expressed as a percentage between 0 and 100%. A yellow at 0% brightness will be black, while the same yellow hue and saturation at 100% brightness will be the full yellow colour.

Colour gamut

Colour theory: gamut

Colour gamut describes the range of potential colours a system can reproduce

Colour gamut is a way of describing the full range of potential colours a system can reproduce. It may surprise you to learn that the range of colours achievable in CMYK is different to that you can achieve with RGB.

This is partially because of the nature of the two different systems, but also (in the real world at least) as a consequence of limitations in our technology – screens aren’t always capable of producing the same range of colours as each other, and pigments reflect light at a non-uniform rate as you reduce their saturation.

Colour perception

Finally, it’s worth looking at how different colours can affect the way we perceive other colours. A typical illustration of this features a mid-grey tone placed over a light grey background, and the same mid-grey tone shown over a dark grey background.

The apparent brightness of the mid-grey is altered according to the context in which you see it – a trick of the eye, working to make sense of its surroundings. Hues works in the same way as tones when placed adjacent to other colours, allowing you to create different effects using the same palette of colours.

Further reading

There's more to explore in the world of colour, which is why we've got a tag for all of our articles on the subject of colour. Visit creativebloq.com/tag/colour to explore our latest colour articles, or read some of these highlights below.

01. The designer’s guide to using colour in branding

Colour sells. Whether you’re working with a product, service or space, the ‘right’ combinations of colours can influence how someone feels, thinks and behaves – with powerful results.

What are the ‘right’ combinations, and how can designers sidestep subjective debates to harness the power of colour more effectively in branding projects? Computer Arts magazine takes a look in this guide, speaking to experts in colour branding and looking at tools to help you make the right choices.

02. How to pick the perfect colour palette every time

In the 1980s, colour psychologist Angela Wright identified links between patterns of colour and patterns of human behaviour. She went on to develop the Colour Affects System, which identifies links between four colour groups and four basic personality types, based on original research involving Aristotle, Newton and German writer Johann Wolfgang von Goethe.

If harnessed correctly, designers can use the Colour Affects System to control the message of their colour palettes and, crucially, kill subjective debate around colour in client meetings with evidence to back up their decisions. This guide from Computer Arts magazine's colour issue explains how it works…

03. How to manage colours in Photoshop

This article provides a great overview for users who are new to colour management, with practical advice for managing colours in Photoshop.

It explores how to convert your images from RGB to CMYK mode, and the effect this will have on the colours within your image; how to customise your colour settings to suit your particular needs; and how to sync your colour profile across all of your Adobe CC apps, add a particular colour profile provided by your printer, and preview a CMYK version of your design without losing any RGB information.

Get Adobe Creative Cloud
04. 10 colour management terms designers need to know

Getting your colours right means getting your head around some tricky terms. There are a number of jargon terms that might baffle you – so we've put together this handy guide. 

Have a read, and you'll soon be able to sort your spectrophotometer from your tristimulus colorimeter…

05. 4 ways to master colour in logo design

Colour is a universal language in design. It can help convey a brand’s personality, create market standout, and evoke an emotional response. This article reveals four ways to work with colour more effectively in your logo design work… 

06. Outstanding uses of colour in branding

Successfully 'owning' a colour is a big deal. With this in mind, we've explored how different brands around the world have staked their respective claims to 10 colours – in some cases with considerable success.

07. The best colour tools for web designers

For web designers, one of the most important choices to make is over colour selections. Choose the wrong ones, and you might just lose out on an opportunity.

But how do you know which colours work well together? To help with the important task of colour selection, this article points you in the direction of some of the best free colour tools on the web (plus one special bonus at the end for Mac users).


Cool App: Unsplash Wallpapers for Mac and Android

Original Source: http://feedproxy.google.com/~r/abduzeedo/~3/rivBrtd8CxI/cool-app-unsplash-wallpapers-mac-and-android

Cool App: Unsplash Wallpapers for Mac and Android

Cool App: Unsplash Wallpapers for Mac and Android

AoiroStudio
Oct 12, 2017

We are sharing a cool app by the mighty folks from Unsplash. Having shared their API a couple weeks ago, they created an easy-to-use app for all of us. It’s very easy, forget the days where you used to download the wallpaper and playing with your screen settings. Within a few clicks, there you have it with a new/fresh wallpaper. Wanna try it out, get it now.

Cool App: Unsplash Wallpapers for Mac and AndroidUnsplash Wallpapers for Mac and Android

In their words

Which is why we’re so consistently awestruck at Unsplash. How do Unsplash contributing photographers capture so much staggering beauty — and with such incredible regularity, too? Are they actual magicians? If you strike up a conversation with one of them (like we are fortunate enough to get to do) you realize it all comes down to a love for capturing moments.

Of all the ways that Unsplash photos get used, the biggest one is definitely wallpapers. ‘Black mirrors’ are everywhere so it’s no wonder one of our most popular Unsplash collections is for desktop wallpaper and iOS/Android lock screen art. We wanted to make the process of getting Unsplash wallpaper even easier — skipping the manual labour of downloading photos and playing with your screen settings.

More Links
Learn more about Unsplash Wallpapers
Get the Unsplash Wallpapers via Mac App Store
Get the Unsplash Wallpapers via Google Play
App Gallery
Cool App: Unsplash Wallpapers for Mac and AndroidCool App: Unsplash Wallpapers for Mac and Android

 

unsplash
wallpapers
wallpaper
web apps


How to Use Warnings and Errors in Sass Effectively

Original Source: https://www.sitepoint.com/warnings-and-errors-in-sass/

The following is a short extract from our book, Jump Start Sass, written by Hugo Giraudel and Miriam Suzanne. It’s the ultimate beginner’s guide to JavaScript. SitePoint Premium members get access with their membership, or you can buy a copy in stores worldwide.

Our incredible journey through Sass is slowly coming to an end, and so far you’ve been doing great! There’s one technical chapter left before we look at project architecture, and then you’ll be fully equipped to write Sass code in your own projects.

Now we’re going to look at warnings and errors. Both form a one-way communication system between the program (in this case, Sass) and the developer (you). If you’re wondering about the point of errors in the CSS world, remember that you already know the answer. Whenever you forget a semicolon or use a function incorrectly, Sass throws an error at you, explaining what you’ve done wrong and how you can fix it, thankfully! It would be a real pain to have to dig into the code to figure out what’s gone wrong.

Sass has long provided a way to emit warnings from stylesheets, but it’s only recently added support to throw errors as well—and for good reason! Over the last few years, Sass has allowed authors to build complex systems to abstract difficult or repetitive patterns and concepts, such as grids. These systems must be able to communicate with authors, stopping the compilation process with a custom error message if anything ever goes wrong.

Both warnings and errors are emitted in the current output channel. When compiling Sass by hand or by using a tool through a command line interface (CLI) such as Grunt or Gulp, the output stream is the console. For tools that include a user interface, such as Codekit or Prepros, it’s likely that they catch and display warnings and errors as part of their interface. Online playgrounds such as CodePen and SassMeister manage to catch errors but not warnings, so don’t be alarmed if you’re unable to test them in there.

Warnings

As has been stated, the ability to emit warnings in Sass is not new. It’s possible to display messages or the value of any SassScript expression to the standard output stream through the @warn directive.

A warning has no impact on the compilationprocess; it does not prevent compiling to pursue or change it in any way. Its only purpose is to display a message in the console.

There are a lot of reasons to use warnings in Sass. Here are a couple, but you’re likely to find your own:

informing the user of an assumption made about the code in order to avoid surprise and hard-to-track bugs
advising about a deprecated function or mixin as part of a library or framework

Sending a warning is dead simple to do: start with the @warn directive, then state whatever it is. Warnings are usually made to provide some information and context, so they often feature a sentence explaining the situation. That being said, you don’t have to use a string; you can warn with a number, a list, a map—whatever. Here, we print a string:

@warn ‘Uh-oh, something looks weird.’;

Using a regular CLI client, this warning will emit the following output:

WARNING: Uh-oh, something looks weird.
on line 1 of /Users/hgiraudel/jump-start-sass/warning.scss

Hey, that’s nice, isn’t it? Although this warning is far from helpful. It says that something looks weird but does not say what, why, or what can be done to stop it from looking weird. We’ll discuss how we can improve on warnings further on.

Let’s move on to a more serious example now that we know how to use he feature. Imagine we have a Sass custom function that attempts to convert a pixel value in em unit:

@function px-to-em($value, $base-font-size: 16px) {
@return ($value / $base-font-size) * 1em;
}

// Usage
.foo {
font-size: px-to-em(42px); // 2.625em
}

All good. Now, what happens when passing a unitless number—such as 42—to the function? Maybe you’ve guessed it, but as it’s not quite obvious I’ll give you the answer:

2.625em/px isn’t a valid CSS value.

This happens because you’re trying to perform a calculation between incompatible units (px and em). What we could do to circumvent this issue is assume the unitless value be expressed in pixels and convert it first:

@function px-to-em($value, $base-font-size: 16px) {
@if unitless($value) {
@warn ‘Assuming value `#{$value}` to be in pixels; attempting to convert it.’;
$value: $value * 1px;

}

@return ($value / $base-font-size) * 1em;
}

The function is expecting a value expressed in pixels. We can still make it work with a unitless value; however, we cannot be sure that this is the expected behavior. We can only assume that it’s good enough.

Because we’re assuming what is the correct behavior for our function, it’s important to let the developer know what we’re doing and why. Otherwise it could lead to bugs that are hard to track, which is not
what you should be aiming for.

Another practical example would be to warn against the usage of a deprecated function or mixin. You might have already heard of or used Bourbon, a lightweight mixin library for Sass. Bourbon is actively maintained, and sometimes requires removing helpers from the library. To avoid suddenly breaking a person’s ode, Bourbon warns about future deprecations way before it actually removes mixins:

@mixin inline-block {
display: inline-block;

@warn ‘The `inline-block` mixin is deprecated and will be removed in the next major version release.’;
}

Clever! People who still use the inline-block mixin from Bourbon are aware that the library will remove it completely in the next version, so they know to start updating their codebase to remove the mixin.

The Difference between @warn and @debug

You may or may not be familiar with the @debug directive, which prints the value of a SassScript expression to the standard output stream in the same fashion as @warn. You might be wondering why there are two features performing the same task, and what could possibly be the difference between the two.

Continue reading %How to Use Warnings and Errors in Sass Effectively%

4 Web Design Tips to Make Video Content More Effective

Original Source: http://feedproxy.google.com/~r/Designrfix/~3/NcDDgUBvOHs/4-web-design-tips-video-content-effective-2

Many websites nowadays have video content of some form or other due to how effective it can be. However in some cases that effectiveness is hindered by the fact that the design of the website doesn’t take into account the unique nature of videos, and ends up hindering it rather than helping.   Assuming you’d […]

The post 4 Web Design Tips to Make Video Content More Effective appeared first on designrfix.com.

5 Common Mobile App Development Mistakes You Should Never Make

Original Source: http://feedproxy.google.com/~r/Designrfix/~3/x8o96OEanUY/5-common-mobile-app-development-mistakes

Forrester predicted that 46% of the global population will use smartphones by the end of 2016 and they were spot on. According to Neilson report, 89% of the time spent on smartphones is spent in using mobile apps. According to Google, 25% of mobile apps are never used while 26% of mobile apps are abandoned […]

The post 5 Common Mobile App Development Mistakes You Should Never Make appeared first on designrfix.com.

JavaScript Functions That Define and Rewrite Themselves

Original Source: https://www.sitepoint.com/javascript-functions-that-define-and-rewrite-themselves/

The following is a short extract from our new book, JavaScript: Novice to Ninja, 2nd Edition, written by Darren Jones. It’s the ultimate beginner’s guide to JavaScript. SitePoint Premium members get access with their membership, or you can buy a copy in stores worldwide.

The dynamic nature of JavaScript means that a function is able to not only call itself, but define itself, and even redefine itself. This is done by assigning an anonymous function to a variable that has the same name as the function.

Consider the following function:

function party(){
console.log('Wow this is amazing!');
party = function(){
console.log('Been there, got the T-Shirt');
}
}

This logs a message in the console, then redefines itself to log a different message in the console. When the function has been called once, it will be as if it was defined like this:

function party() {
console.log('Been there, got the T-Shirt');
}

Every time the function is called after the first time, it will log the message “Been there, got the T-Shirt”:

party();
<< 'Wow this is amazing!'

party();
<< 'Been there, got the T-Shirt'

party();
<< 'Been there, got the T-Shirt'

If the function is also assigned to another variable, this variable will maintain the original function definition and not be rewritten. This is because the original function is assigned to a variable, then within the function, a variable with the same name as the function is assigned to a different function. You can see an example of this if we create a variable called beachParty that is assigned to the party() function before it is called for the first time and redefined:

function party(){
console.log('Wow this is amazing!');
party = function(){
console.log('Been there, got the T-Shirt');
}
}

const beachParty = party; // note that the party function has not been invoked

beachParty(); // the party() function has now been redefined, even though it hasn't been called explicitly
<< 'Wow this is amazing!'

party();
<< 'Been there, got the T-Shirt'

beachParty(); // but this function hasn't been redefined
<< 'Wow this is amazing!'

beachParty(); // no matter how many times this is called it will remain the same
<< 'Wow this is amazing!'

Losing Properties

Be careful: if any properties have previously been set on the function, these will be lost when the function redefines itself. In the previous example, we can set a music property, and see that it no longer exists after the function has been invoked and redefined:

function party() {
console.log('Wow this is amazing!');
party = function(){
console.log('Been there, got the T-Shirt');
}
}

party.music = 'Classical Jazz'; // set a property of the function

party();
<< "Wow this is amazing!"

party.music; // function has now been redefined, so the property doesn't exist
<< undefined

This is called the Lazy Definition Pattern and is often used when some initialization code is required the first time it’s invoked. This means the initialization can be done the first time it’s called, then the function can be redefined to what you want it to be for every subsequent invocation.

Init-Time Branching

This technique can be used with the feature detection that we discussed in the last chapter to create functions that rewrite themselves, known as init-time branching. This enables the functions to work more effectively in the browser, and avoid checking for features every time they’re invoked.

Let’s take the example of our fictional unicorn object that’s yet to have full support in all browsers. In the last chapter, we looked at how we can use feature detection to check if this is supported. Now we can go one step further: we can define a function based on whether certain methods are supported. This means we only need to check for support the first time the function is called:

function ride(){
if (window.unicorn) {
ride = function(){
// some code that uses the brand new and sparkly unicorn methods
return 'Riding on a unicorn is the best!';
}
} else {
ride = function(){
// some code that uses the older pony methods
return 'Riding on a pony is still pretty good';
}
}
return ride();
}

After we’ve checked whether the window.unicorn object exists (by checking to see if it’s truthy), we’ve rewritten the ride() function according to the outcome. Right at the end of the function, we call it again so that the rewritten function is now invoked, and the relevant value returned. One thing to be aware of is that the function is invoked twice the first time, although it becomes more efficient each subsequent time it’s invoked. Let’s take a look at how it works:

Continue reading %JavaScript Functions That Define and Rewrite Themselves%