Posts relating to
Dev Tricks

CSS media query hover

Detecting mobile devices using the CSS4 ‘hover’ media query

Have you needed to apply styling to only touch devices, or only non-touch devices? Well, great news, with CSS4 @media (hover: [value]) can come to the rescue in a multitude of ways. What is CSS4? For some time we’ve been working with CSS3, which I think is pretty epic, espcially when compared to what came […]

Cross-browser support for hiding scrollbars, including FireFox

Cross-browser support for scrollbar styling and visibility is a challenge. It’s as simple as that. This article provides a solution that addresses the issue of hiding the scrollbars, using scrollbar-width, ::-webkit-scrollbar and -ms-overflow-style. What are Scrollbars? Scrollbars are bars that appear down the right-hand side and across the bottom of the browser (or an element […]

Little wins for webpage performance.

Being a developer I’m often looking for little ways to improve website performance, such as how fast a website loads and the user’s browsing experience. There’s a little known trick that helps with the latter, simply by not inheriting the overheads of pages you click through to. What you probably didn’t know about opening links […]

Compress directories from the command line, excluding node_modules and development files

This simple article provides a CLI command to compress a directory whilst excluding specific sub-directories and files. We do a lot of custom development using modern development tools. From time-to-time we need to compress certain directories for deployment to production. In such cases, it is very common that some files and sub-directories need to be […]

IntelliJ SASS resource not recognised

How to fix the issue with IntelliJ and PHPStorm not resolving SASS and JS Imports

This article describes how to resolve the issue with IntelliJ not providing autocomplete for imported SASS and JS resources. The same fix can be applied to PHPStorm. IntelliJ is an awesome IDE, but recently it stopped recognising imported SASS and JS resources. This didn’t stop them from compiling, but was very annoying, as it flagged […]

Custom links only in menu meta box

Remove menu link types from the WordPress menu options screen

On a client site, we wanted to restrict menu items to Custom Links, only. Thus remove all other menu types. The main drive behind this was to improve the user experience and reduce confusion, as the menu is only for Social Links. With a brief search yielding very little I set about coding a solution, […]

Overflowing text on mobile device

How to break long words using CSS @supports

Recently, I had an odd scenario where wrapping long text needed either word-wrap, overflow-wrap or word-break to achieve the same overflow pattern across different browsers. To arrive at a suitable solution I opted to use @supports to maintain control of the declarations. What is @supports? @supports is a feature query, whose associated block of statments […]

Conditionally enqueue scripts and stylesheets on specific pages

There are many use-cases where scripts and stylesheets only need to be loaded on certain pages. One such example would be to only load the JavaScript and CSS stylesheets for Contact Form 7 (a lightweight contact form plugin) on the contact page. This article will demonstrate how to conditionally load the JS and CSS for […]