Thursday, March 30, 2017

CSS Viewport Units: A Quick Start

CSS Viewport Units

Thank you to Dave Maxwell and Ralph Masonfor having reviewed this article.

It has been a few years since viewport units were first introduced in CSS. They are truly responsive length units in the sense that their value changes every time the browser resizes. If you have heard about these units before but never learned about them in detail, this article can help you out.

The Units and Their Meaning

There are four viewport based units in CSS. These are vh, vw, vmin and vmax.

  • Viewport Height (vh) — This unit is based on the height of the viewport. A value of 1vh is equal to 1% of the viewport height.
  • Viewport Width (vw) — This unit is based on the width of the viewport. A value of 1vw is equal to 1% of the viewport width.
  • Viewport Minimum (vmin) — This unit is based on the smaller dimension of the viewport. If the viewport height is smaller than the width, the value of 1vmin will be equal to 1% of the viewport height. Similarly, if the viewport width is smaller than the height, the value of 1vmin will be equal to 1% of the viewport width.
  • Viewport Maximum (vmax) — This unit is based on the larger dimension of the viewport. If the viewport height is larger than the width, the value of 1vmax will be equal to 1% of viewport height. Similarly, if the viewport width is larger than the height, the value of 1vmax will be equal to 1% of hte viewport width.

Let's see what the value of these units will be in different situations:

  • If the viewport is 1200px wide and 1000px high, the value of 10vw will be 120px and the value of 10vh will be 100px. Since the width of the viewport is greater than its height, the value of 10vmax will be 120px and the value of 10vmin will be 100px.
  • If the device is now rotated so that the viewport becomes 1000px wide and 1200px high, the value of 10vh will be 120px and the value of 10vw will be 100px. Interestingly, the value of 10vmax will still be 120px because it will now be determined based on the height of the viewport. Similarly, the value of 10vmin will still be 100px.
  • If you resize the browser window so that the viewport becomes 1000px wide and 800px high, the value of 10vh will become 80px and the value of 10vw will become 100px. Similarly, the value of 10vmax will become 100px and the value of 10vmin will become 80px.

At this point, viewport units may sound similar to percentages. However, they are very different. In the case of percentages, the width or height of the child element is determined with respect to its parent. Here is an example:

See the Pen Viewport Units and Percentage by SitePoint (@SitePoint) on CodePen.

As you can see, the width of the first child element is set to be equal to 80% of its parent's width. However, the second child element has a width of 80vw, which makes it wider than its parent.

Applications of Viewport Units

Since these units are based on viewport dimensions, it is very convenient to use them in situations where the width, height or size of elements needs to be set relative to the viewport.

Continue reading %CSS Viewport Units: A Quick Start%


by Asha Laxmi via SitePoint

The Right Way to Share State Between Swift View Controllers

How Can I Use Laravel Envoyer or Deployer with SemaphoreCI?

Test automation, continuous integration, and continuous delivery are quite widespread in the community now. This brought to life multiple services trying to make the process more enjoyable and less overwhelming for developers, so they can focus on delivering software instead of building/configuring tools to do that. One of those services is SemaphoreCI.

In this article, we're going to cover how to use our own deploy scripts and tools to continue the deployment process after a successful test.

We will be using SemaphoreCI for continuous delivery and Deployer to push our code to the DigitalOcean production server. If you're not familiar with Deployer, we recommend you check out this introduction.

Combination of SemaphoreCI and Deployer logos

Demo Application

We'll be using a 500px application that loads photos from the marketplace. It was built using Laravel and you can read the full article about its building process here, and find the repo on GitHub.

Creating a Deployer Script

The way Deployer works is by us defining servers, and then creating tasks that handle the process of deploying the application to those servers. Our deploy.php script looks like this:

<?php 

require_once "recipe/common.php";

set('ssh_type', 'native');
set('default_stage', 'staging');
env('deploy_path', '/var/www');
env('composer_options', 'install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction');
set('copy_dirs', [
    'app/commands',
    'app/config',
    'app/controllers',
    'app/database',
    'app/lang',
    'app/models',
    'app/src',
    'app/start',
    'app/tests',
    'app/views',
    'app/filters.php',
    'app/routes.php',
    'bootstrap',
    'public',
    'composer.json',
    'composer.lock',
    'artisan',
    '.env',
]);

set('shared_dirs', [
    'app/storage/cache',
    'app/storage/logs',
    'app/storage/meta',
    'app/storage/sessions',
    'app/storage/views',
]);
set('writable_dirs', get('shared_dirs'));
set('http_user', 'www-data');

server('digitalocean', '174.138.78.215')
    ->identityFile()
    ->user('root')
    ->stage('staging');

task('deploy:upload', function() {
    $files = get('copy_dirs');
    $releasePath = env('release_path');

    foreach ($files as $file)
    {
        upload($file, "{$releasePath}/{$file}");
    }
});

task('deploy:staging', [
    'deploy:prepare',
    'deploy:release',
    'deploy:upload',
    'deploy:shared',
    'deploy:writable',
    'deploy:symlink',
    'deploy:vendors',
    'current',// print current release number
])->desc('Deploy application to staging.');

after('deploy:staging', 'success');

You should read the Deployer article if you'd like to learn more about what this specific script does. Our next step is to set up a SemaphoreCI project. Please read the crash course article if you've never tried SemaphoreCI before, and do that.

Continue reading %How Can I Use Laravel Envoyer or Deployer with SemaphoreCI?%


by Younes Rafie via SitePoint

Hestia Pro

Hestia

'Hestia Pro' is a powerful One Page WordPress theme suited for a digital agency or service business. Features include intro slideshow, services section (with video embed), team, pricing table, testimonials, newsletter sign up box, blog feed, Twitter Feed, Instagram Feed and a contact form. This is a solid follow up One Page theme by ThemeIsle to their hugely popular Zerif Lite WordPress theme. Note the $99 Price Tag is for full club membership with 20+ themes and 3 domain licenses - huge value.

There is also a Free Version of Hestia with reduced features to give the theme a real go before buying.

by Rob Hope via One Page Love

​Active Collab: How Collaboration Should Have Been All Along

This article was sponsored by Active Collab. Thank you for supporting the partners who make SitePoint possible.

Collaboration differs from team to team. All teams eventually discover their own unique workflow, although the way in which teams implement those workflows is fundamentally similar. Let's take file uploads as an example. Designers will upload their designs, writers will upload their writings. Regardless of what the team does, it’s a safe bet that they’ll use file uploads.

It doesn’t matter if you’re a designer, a writer, a marketer, or whatever: the best collaboration tools are those that master the core features — task management → feedback → time-tracking → invoicing. Enter Active Collab.

Powerful yet simple, Active Collab helps your team stay organized when you outgrow email, allowing you to manage tasks effectively, collaborate alongside your clients and delegate when necessary — think Trello, but with calendars, time-tracking and invoicing features built right in.

All Features in One Place

Whatever your team does, Active Collab has your back, allowing you to manage tasks from conception to completion. After estimating, time-tracking and collaborating on tasks, you can then issue invoices to clients when the tasks are complete — all in a single app. Project management works best when these features work cohesively, reducing (or even outright removing) friction which normally occurs when the required functionality is spread far and wide across various apps. With Active Collab, all of the management tools are united under one subscription.

A seamless experience is a happy (and productive) experience!

Active Collab Kanban

Task Management

Run your business like a well-oiled machine. Stay organised start to finish with advanced to-do lists, and manage your team’s progress every step of the way. While Active Collab has all the functionality you’ll ever need — time and expense tracking, file uploads, discussions and more — team members will only see what they need to see with their own unique dashboard.

Personalised dashboard

Team Collaboration

Collaboration simply doesn’t work without communication. Luckily, Active Collab helps teams connect with @mention functionality, collaborative writing tools, and an easy-to-read calendar that ensures that you’ll never miss a deadline.

It’s time to ditch email. Active Collab ensures that your messages are treated as actionable tasks with due dates, and not inbox items that become weighted down and lost by mid-afternoon.

Time Tracking

With Active Collab, you can set hourly rates for the different types of work that your team does, and have the Active Collab Timer app record your hours automatically. While you focus on the task at hand, Active Collab does the rest, leaving you with the peace of mind that clients are being billed accurately, and, of course, saving you from the hassle of having to track time manually (which, ironically, can be very time-consuming!)

Continue reading %​Active Collab: How Collaboration Should Have Been All Along%


by Daniel Schwarz via SitePoint

6 Free Web-Based SVG Editors Compared

While SVG images may not be as common as our favorite bitmap formats like PNG or JPG, the advantages of vectors has more and more designers looking to bring them into their projects.

In the past, we’ve usually looked at desktop applications like Adobe Illustrator and Inkscape – but in 2017 you don’t have to leave your web browser to design in vectors. So, if you’re looking for a free SVG editor, these 6 free Web-based SVG editors are a good start.

1. Vectr

Vectr

Vectr is a good choice for both beginners and more advanced SVG users. Its interface is neat and it doesn’t overwhelm with a gazillion of tools you never use. This is great for newcomers to vector illustration because you shouldn’t feel lost among all the tools you have no idea what to use for. It comes with some tutorials as well, so even if you are a total stranger to SVG, you still will be able to start using it quickly.

This doesn’t mean Vectr lacks features – it has all the basic stuff, such as shapes, text, layers, shadows, borders, backgrounds, etc. you need to create a basic image. It doesn’t have all the glory of a full-fledged desktop editor but for some quick designs and edits, it makes it. You can either start a new file from scratch or upload an existing image.

You might get frustrated when uploading more complex illustrations and maps to Vectr as we’ve found it doesn’t always handle them well. But for simpler SVGs – icons, logos and the like – it’s mostly fine.

If you feel the Web version doesn’t offer what you need, you can find more features in the desktop ones. Vectr is available for Windows, Mac, Linux, and Chromebook.

Perhaps the single coolest features Vectr offers is the provision of linkable URLs to your graphic. This means you could display your Vectr SVG artwork on an external WordPress, Medium, Tumblr or other sites that allows display of SVG but blocks upload SVG to their servers.

Vectr also offers the ability to share your graphic within a Vectr editor panel, allowing others to edit the graphic you supply. This mean you could, for instance, provide a logo in a template design that users could then customize to their own requirements.

To this end, Vectr have recently released version of the products as a WordPress plugin for Vectr.

2. RollApp

Unlike the other tools on the list, when you go to RollApp’s homepage, you don’t see the tool right away. The reason is that RollApp isn’t a single app, it’s a package of apps and their SVG editor is just one of these apps. It’s a great tool, though, because this is a browser-based version of Inkscape.

If you want to use RollApp, you need an account. You can either register a new account or login with Google, Facebook, Amazon – very handy because I really hate it to create thousands of new accounts just to see the app I am registering for isn’t what I need.

After you login, you will see the following:

RollApp

Yep, it’s Inkscape in all its glory! No doubt, RollApp is the most feature-rich app on this list – you are practically using Inkscape in your browser! I didn’t compare it item by item but it looks very much they have ALL the features of Inkscape, such as layers, objects, text, path, filters, effects, extensions, etc.

Be aware that with larger files, it’s not too fast because you are performing the actions on their servers over the Internet. In short, if you want to edit large and complex stuff, RollApp might not be ideal, but for any other task beyond basic edits, this may the best Web-based editor out there.

3. BoxySVG

BoxySVG

If you have been reading SitePoint, you probably already know about BoxySVG because we have covered BoxySVG quite a bit over the past 12 months. I am not going to review it in more detail because this BoxySVG review tells more than I can tell, so read it.

Importantly, BoxySVG has added a code inspector since Alex’s original review, making this one of the most relevant SVG tools for web developers.

4. Janvas

Janvas

Janvas was a very popular SVG editor a couple of years ago. Unfortunately, it doesn’t seem under active development in recent years and even though it’s still working, as the Web moves forward and Janvas sits still, it’s becoming less of a choice. In fact, Alex from SitePoint used it quite a bit in 2013-14 (including the paid version) and was even answering some of the support questions on the Janvas Google+ for a while. Janvas was a powerful app.

The main problem with Janvas is that it’s not very up-to-date. As browsers evolve, apps that don’t evolve get a tiny bit buggier every day. Janvas has tons of features, including shapes, text, drawing tools, paths, masks, and layers but – as user report in the forums attest – many of these features don’t produce the desired results.

The encouraging news is that a new version is coming as a Chrome app. Let’s hope it fixes these issues.

5. DrawSVG

DrawSVG

Maybe you’ve already found your free Web-based SVG editor among the apps so far but if you haven’t, here is more. DrawSVG is a fully standard compliant SVG editor with a lot of features. What I really like about it that it has the look and feel of a Web app – i.e. menu on the left, click to open submenu, etc. - rather than the look and feel of a desktop app ported for the Web.

With DrawSVG you can draw, modify, and render objects. This includes drawing basic shapes, Bezier curves, straight and curved text, numerous stroke and fill styles, etc. You can also export your SVG to PNG.

Continue reading %6 Free Web-Based SVG Editors Compared%


by Ada Ivanoff via SitePoint

Beer – Cory Gibbons

Beer - Cory Gibbons

Single Serving One Pager providing a log of the unique beers consumed by designer, Cory Gibbons. Dare I say that's an awesome use of the .beer domain extension 🍻

by Rob Hope via One Page Love