Author: Ignacio

Everything I know about CSS Variables Custom Properties

Brain dump about CSS Custom Properties, AKA CSS Variables They are not variables They are actually called CSS custom properties. Huh. We’ll refer to them as variables for brevity. Declaring variables To declare new variables, you just add a new property that begins with –, inside a ruleset: What is :root? If you notice, in the previous example, in the previous MDN link and other tutorials, you’ll see that variables are declared inside a :root, instead of html {…}, body{…} or whatever. According to MDN, :root is a pseudo-class that matches the root of the tree representing the document. In […]

Read entry

How to convert SVG files to PNG automatically

A few weeks after the designer handed off about 500 tidy little icons, some customer requested PNG versions for all those. Of course one option would be to export all again in PNG format. While possible, I wanted to simplify the designer’s job after creating new icons: hand off the SVGs and we’ll take care of the rest. After researching some alternatives, I ended up implementing this in Bash, using rsvg-convert from librsvg. Install librsvg in macOS brew install librsvg The following script goes through all .svg files in a particular /files folder and converts them to a 400 width […]

Read entry

Enable Custom Post Order via code in WordPress

Recently I enabled the great Simple Custom Post Order (SCPO) plugin in a bunch of sites. After you activate it you can go into its settings and enable sorting for all posts, custom post types, taxonomies, etc. We had a particular case though. At my current job, we manage a network of nearly 200 WordPress sites. It makes no sense logging to 200 sites’ admin to update their values. In every site, we needed to Upload and activate SCPO. Enable sorting for categories only. First one can be handled by ManageWP or other remote-access tools. The second seemed a bit […]

Read entry