whoami
Lucas Jenß
cat /etc/motd
The Coding Journal ツ — Notes taken on an epic coding journey. Technical solutions, debugging notes, and practical guides from the trenches of software development.
ls -la ~/languages/
- drwxr-xr-x
- ▶ PHP
- ▶ Ruby
- ▶ Scala
- ▶ C#
- ▶ JavaScript
- ▶ Objective-C
- ▶ Shell Scripting
ls -la ~/toolchain/
- drwxr-xr-x
- ▶ Typo3
- ▶ Akka
- ▶ Capistrano
- ▶ Git
- ▶ MAMP
- ▶ Adobe Illustrator
- ▶ NSTrackingArea (Cocoa)
uname -a
- drwxr-xr-x
- ▶ Mac OS X
- ▶ Unix
Adding custom SVG filters to Illustrator for web reuse
Adding a custom SVG filter to Illustrator’s library gives designers a repeatable way to shape vector artwork without rebuilding the same effect in every file. It is especially useful for web design work involving soft shadows, textured edges, glows or subtle colour shifts. The important distinction is that Illustrator’s SVG Filters panel is an authoring tool: it helps you store, preview and apply the effect, while the browser still needs a valid SVG filter definition in the delivered asset.
Treating those as separate stages prevents a familiar Illustrator surprise. A panel preview can look convincing while the exported SVG lacks the primitive you expected, clips the shadow or renders with a different blur radius in Safari and Chrome. A durable workflow keeps one small, readable SVG source file, imports it into Illustrator for visual work and verifies the exported markup in the browsers used by the project team.
Australian teams in Sydney and Melbourne often move Illustrator artwork into WordPress, Shopify or custom application builds, so asset portability matters more than a convenient panel entry. Australian English normally uses the local spelling colour, and Australian Government teams in Canberra are commonly assessed against the Digital Service Standard and WCAG requirements. The filter should therefore remain lightweight, predictable and usable on the slower mobile connections encountered by many customers across Australia.
Understand where the filter runs
The first decision is whether a filter belongs to the runtime asset or primarily to the design-stage library. Browser-rendered SVG carries definitions in <defs> and applies them with CSS or an SVG attribute. Illustrator uses an imported preset and its SVG Filters panel. Both routes can produce the same design, but their authoring controls and failure modes differ.
| Concern | Browser-rendered SVG | Illustrator filter library |
|---|---|---|
| Definition | Inline <defs> or a shared SVG sprite |
An imported .svg file listed in the SVG Filters panel |
| Application | CSS filter or filter="url(#id)" |
A panel command applied to selected artwork |
| Main purpose | Runtime appearance in the published page | Reusable preview while preparing vector assets |
| Main risk | Browser-specific interpolation, clipping or an unresolved ID | A panel preview that is missing or rasterised after export |
Start with a restrained definition that uses widely supported filter primitives. For a shadow, feGaussianBlur, feOffset, feFlood, feComposite and feMerge are safer than relying on a newer convenience effect. Keep the filter region generous enough to contain the blur, and retain color-interpolation-filters="sRGB" so the browser does not change the colour calculation unexpectedly.
<svg xmlns="http://www.w3.org/2000/svg">
<filter id="soft-shadow"
filterUnits="objectBoundingBox"
x="-25%" y="-25%" width="150%" height="150%"
color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/>
<feOffset in="blur" dx="0" dy="5" result="offset-blur"/>
<feFlood flood-color="#14213D" flood-opacity="0.24"
result="shadow-colour"/>
<feComposite in="shadow-colour" in2="offset-blur"
operator="in" result="shadow"/>
<feMerge>
<feMergeNode in="shadow"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</svg>
Save the definition separately from the artwork, with a stable, lowercase ID such as soft-shadow. Use inline attributes rather than an external stylesheet or CSS class; Illustrator’s importer is more predictable when the file is self-contained. Reference it from a small browser test shape before importing it, because valid XML can still contain an unsupported combination of primitives.
Add the filter to Illustrator's library
Put source filters in a versioned folder such as assets/svg-filters, and name files after their effect rather than the project that first needed them. Open the SVG Filters panel from the Window menu, then use its add or import command to select the .svg file. The wording of the button varies slightly between Illustrator releases, but the imported effect should appear in the panel with a thumbnail.
Apply the imported effect to a simple rectangle rather than a complex logo. Illustrator may display a warning, an empty result or a different colour if the SVG lacks a filter ID, uses an unsupported primitive or has a filter region that clips the output. This small test isolates importer problems from artwork problems and gives you a clean reference for the expected result.
Do not treat the panel entry as your master copy. Some Illustrator versions copy imported presets into an application-level filter directory, while others leave them as session entries, so the library can change when you upgrade or reinstall. Keep the original SVG in version control, re-import it after a fresh installation and share that file with the team. The source-first habit is particularly useful for engineers publishing working notes, as seen on Tshepang's site, where the environment around a fix remains part of the solution.
Apply and export the filtered artwork
Once imported, select the vector artwork and apply the filter from the panel. Compare it with the browser test at the intended display size, especially around thin strokes and small icons. A blur measured in user coordinates can appear too soft on a 16-pixel symbol but tasteful on a 320-pixel illustration. The filter should be evaluated at the size it will occupy, not only on the artboard.
Export the artwork as SVG and inspect the markup in a text editor before handing it over. Confirm that the relevant <filter> definition is present, that its ID matches every reference and that the filter region extends beyond the shape. Avoid flattening or rasterising the artwork unless the delivery format requires it, since baked effects can increase the payload and remove editable primitives. If Illustrator’s export changes the effect, retain the original and reproduce the filter in the final <defs> block instead of assuming the panel preview survived.
Document the source file, supported Illustrator version and expected browser behaviour alongside the asset. That habit has the same source-first value as Ruby documentation with YARD: the generated artefact is useful, but repeatable instructions and inputs remain the durable part. For web delivery, include the final SVG, not just an .ai file, so developers can see which definitions and IDs must survive.
Reuse the filter across projects
There are two practical levels of reuse. Inside Illustrator, the imported panel entry provides quick access for every document on that installation. In the codebase, keep the canonical filter definition in a shared partial or SVG sprite, give it one stable ID and reference it from each symbol or component. This avoids copying a long filter block into dozens of exported files and makes a radius or colour adjustment a single controlled change.
Test the second level as a flow rather than a one-off render. It is comparable to TestProbe actor-flow checks: the value comes from confirming that the same dependency behaves correctly across every path that uses it. Check standalone SVG, an inline symbol and the complete page, including hover effects and visual focus states that may rely on the filtered element.
For Australian public-sector and e-commerce work, accessibility and performance deserve equal attention. WCAG-oriented reviews make visible focus and sufficient contrast practical acceptance criteria, while Shopify and WooCommerce stores need to remain usable on mobile data. A filter with a huge region or expensive turbulence can add rendering work even when the SVG file itself is small. An authoring check keeps the source under control:
- Give the filter a descriptive lowercase ID and preserve it in every reference.
- Test the standalone SVG in Chrome, Safari and the project’s supported mobile browsers.
- Keep the filter region just large enough for the visible effect to avoid unnecessary raster work.
- Record Illustrator versions that change the preview or export behaviour.
A deployment check catches problems after the asset enters a theme or component system:
- Inline shared
<defs>when external SVG references could trigger cross-origin restrictions. - Recheck keyboard focus and contrast after shadows, glows or colour matrices are applied.
- Compare the production page on a throttled mobile connection, not only on a studio workstation.
- Commit the canonical filter file and note changes in release notes.
Make the filter part of a maintainable workflow
Treat the custom effect as source code with a visual output. Keep a small sample SVG, the Illustrator artwork and the final web asset under version control, then review changes in both the design application and a browser. If the filter stops working after an Illustrator update, compare the current SVG with the last known-good definition instead of replacing it with a flattened screenshot. This preserves editability and makes regressions obvious.
Create the filter folder, save one browser-safe SVG, import it into Illustrator and test one exported shape today; then commit the source file so the next designer or developer can reuse the effect without hunting for it.
cat ~/interests.json
| Key | Value |
|---|---|
| editor | Terminal-first workflow |
| os | Mac OS X / Unix |
| vcs | Git, distributed version control |
| deploy | Capistrano, cron automation |
| graphics | SVG, Adobe Illustrator troubleshooting |
| networking | IP validation, SSH, VPN |
git log --oneline --reverse
Solving SVG import issues in Adobe Illustrator CS6 and CC
When importing an SVG into Illustrator, the operation fails with an unknown error [CANT]. A workaround for this Adobe-side bug.
Solving NDK build issues on OS X
Troubleshooting native development kit compilation problems on Mac OS X.
Programmatically adding PHP generated TypoScript to the backend configuration
Integrating dynamically generated TypoScript into Typo3 backend setups using PHP.
ArgumentError: Could not parse PKey: no start line
Debugging an SSH key parsing error encountered during deployment.
Validating IP-Addresses in PHP
Using PHP filter functions with flags like FILTER_FLAG_IPV4 and FILTER_FLAG_IPV6, and understanding how filter_var handles reserved IP addresses.
Cocoa: Using NSTrackingArea
A short tutorial on using Cocoa's NSTrackingArea to capture mouseEntered and mouseExited events.
cat ~/contact.txt