nerdfisch: DevBits

Kleine, aber feine Code-Snippets, nützliche Tweaks und elegante Lösungsansätze aus dem Entwickler-Alltag

13.11.2025 | Lothar Ferreira Neumann

Use ternary statements in Twig

ternary-example.html.twig
{# Checks if a URL exists and passes it to the component. Otherwise, sets it to false. Works with primitive data types. #}
{% set link = url ? { url: url } : false %}

{# Checks if the media object is not empty and passes it to the component. Otherwise, sets it to false. Suitable for complex data types like objects. #}
{% set media = media is not empty ? { media: media } : false %}
html
twig
twig
ternary operators
13.11.2025 | Henjo Völker

Jira JQL Filter: Issues with a date field value in the next upcoming month

filter_jira_issues_inside_upcoming_month.jql
AND "[yourDateField]" >= startOfMonth("+1") AND "[yourDateField]" <= endOfMonth("+1")
JQL
Jira
project management
issues
13.11.2025 | Holger Weischenberg

Check whether there is only one child item using CSS

.breadcrumb.scss
    .breadcrumb--item:only-child {
      svg {
        display: none;
      }
    }
    
breadcrumb
css
copy-paste
13.11.2025 | Holger Weischenberg

Simple SCSS compiler setup

package.json
{
  "name": "Foo project",
  "scripts": {
    "sass-dev": "sass --watch --update --style=expanded src/scss:dist/css",
    "sass-prod": "sass --no-source-map --style=compressed src/scss:dist/css"
  },
  "devDependencies": {
    "sass": "^1.86.0"
  }
}
json
scss
Frontend
frontend
npm
13.11.2025 | Holger Weischenberg

Consider the user's preference for dark or light system colors

variables.scss
/* Default theme */
:root {
  --Background-Color: #fff;
  --Text-Color: #000;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    --Background-Color: #000;
    --Text-Color: #fff;
  }
}
scss
themes
frontend
magic