<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SoftOpinie.pl</title>
    <description>The latest articles on DEV Community by SoftOpinie.pl (@softopinie).</description>
    <link>https://dev.to/softopinie</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4270641%2F54ac7fc1-9f32-4267-a4a2-208cccbfb156.png</url>
      <title>DEV Community: SoftOpinie.pl</title>
      <link>https://dev.to/softopinie</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/softopinie"/>
    <language>en</language>
    <item>
      <title>Two vanilla JS pricing calculators inside WordPress that score 100/100 in Lighthouse (and the wptexturize &amp;&amp; bug)</title>
      <dc:creator>SoftOpinie.pl</dc:creator>
      <pubDate>Sat, 28 Nov 2026 11:28:45 +0000</pubDate>
      <link>https://dev.to/softopinie/how-i-built-two-zero-dependency-js-tco-calculators-in-wordpress-and-hit-100100-lighthouse-without-3785</link>
      <guid>https://dev.to/softopinie/how-i-built-two-zero-dependency-js-tco-calculators-in-wordpress-and-hit-100100-lighthouse-without-3785</guid>
      <description>&lt;p&gt;What started as a weekend script to scratch my own itch turned into two standalone tools for &lt;a href="https://softopinie.pl/" rel="noopener noreferrer"&gt;SoftOpinie.pl&lt;/a&gt;, an independent Polish SaaS and hosting review site I run in my free time.&lt;/p&gt;

&lt;p&gt;Straight to the point: static HTML pricing tables rot fast. Owners of promo plans often get blindsided by renewal fees jumping 10x in year two, while half the comparison posts on the web still quote outdated promotional banners from last year. I wanted readers to drag a slider and see real multi year totals with 23% Polish VAT and renewal fees included.&lt;/p&gt;

&lt;p&gt;It looked easy on paper. It was not. Here is a quick rundown of what I shipped inside plain WordPress Gutenberg HTML blocks, why I skipped a heavy frontend framework, and the nasty &lt;code&gt;wptexturize&lt;/code&gt; parser quirk that bit me five minutes after going live.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two tools live right now
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://softopinie.pl/kalkulator-hostingu-3-lata/" rel="noopener noreferrer"&gt;3 Year Polish Hosting TCO Calculator&lt;/a&gt;:&lt;/strong&gt; adds up 36 months of ownership (year 1 promo plus two full renewals, a 23% VAT toggle, a &lt;code&gt;.pl&lt;/code&gt; domain renewal slider from 0 to 10 domains, and paid SSL add ons) across Seohost, LH.pl, and Cyber_Folks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://softopinie.pl/kalkulator-email-marketing/" rel="noopener noreferrer"&gt;2026 Email Marketing Cost Calculator&lt;/a&gt;:&lt;/strong&gt; compares monthly and annual bills across GetResponse, Brevo, and MailerLite using a subscriber slider (250 to 50,000 contacts), sending frequency buttons, and official NBP EUR/PLN conversion rates.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both sit alongside our open Markdown price list on GitHub: &lt;a href="https://github.com/softopinie/awesome-polish-saas" rel="noopener noreferrer"&gt;Awesome Polish SaaS repository&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sometimes the cheapest speed win is not shipping 350 KB of scripts
&lt;/h2&gt;

&lt;p&gt;Looking under the hood, a pricing calculator holds maybe 5 state variables and updates 15 DOM nodes on &lt;code&gt;input&lt;/code&gt; or &lt;code&gt;click&lt;/code&gt;. After a certain point, the dominant cost is framework bootstrap, not your own math.&lt;/p&gt;

&lt;p&gt;Each calculator lives in one HTML block: scoped &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt;, clean markup, and one vanilla JS IIFE (~25 KB before Brotli). No build step, no &lt;code&gt;npm install&lt;/code&gt;, no deployment pipeline. Nothing rerenders, nothing rehydrates, and the browser fires zero extra network requests once the HTML document arrives.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here is the catch: WordPress turns &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; into &lt;code&gt;&amp;amp;#038;&amp;amp;#038;&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Local tests passed with flying colors. Five minutes after publishing the email calculator to WordPress, every button stopped responding and DevTools threw &lt;code&gt;Uncaught SyntaxError: Unexpected token '&amp;amp;'&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Long story short, WordPress runs &lt;code&gt;wptexturize&lt;/code&gt; over Gutenberg HTML blocks and silently rewrites logical &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; operators inside &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags into HTML entities:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Source written in the editor:&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;totalEmails&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;contacts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Output served in the live DOM:&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;totalEmails&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;#&lt;span class="mi"&gt;038&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;#&lt;span class="mi"&gt;038&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;contacts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rather than patching &lt;code&gt;functions.php&lt;/code&gt; to turn off global texturization (which turns into a real headache when themes update or plugins expect default filters), I took the simplest route: &lt;strong&gt;strip &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; completely out of inline WordPress &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; blocks&lt;/strong&gt; using nested &lt;code&gt;if&lt;/code&gt; statements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;totalEmails&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contacts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No server hooks, no fragile filter workarounds, and the code survives every WordPress core update untouched.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three small fixes that pushed Lighthouse Accessibility from 92 to 100
&lt;/h2&gt;

&lt;p&gt;Always test in incognito and on an actual phone before assuming a release held. Running a 390px mobile pass and Lighthouse sanity check caught three small issues right away:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ARIA tab roles on filter bars:&lt;/strong&gt; wrapping buttons in &lt;code&gt;role="tablist"&lt;/code&gt; costs you points unless every button carries &lt;code&gt;role="tab"&lt;/code&gt; and updates &lt;code&gt;aria-selected&lt;/code&gt; on click.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dark theme contrast ratios:&lt;/strong&gt; muted &lt;code&gt;#64748B&lt;/code&gt; labels on &lt;code&gt;#0A0F1E&lt;/code&gt; look crisp on a desktop monitor, yet drop below WCAG AA (&lt;code&gt;4.17:1&lt;/code&gt;). Lifting captions and slider ticks to &lt;code&gt;#94A3B8&lt;/code&gt; and &lt;code&gt;#CBD5E1&lt;/code&gt; cleared every contrast audit while keeping the dark palette intact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crowded range slider ticks below 480px:&lt;/strong&gt; eight horizontal labels collide on a 390px phone screen. Hiding alternate ticks inside one &lt;code&gt;@media (max-width: 480px)&lt;/code&gt; rule opened up ~29px spacing between visible labels.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Numbers after purging LiteSpeed Cache
&lt;/h2&gt;

&lt;p&gt;Running Google PageSpeed Insights on &lt;a href="https://softopinie.pl/" rel="noopener noreferrer"&gt;softopinie.pl&lt;/a&gt; right after clearing cache came back rock solid:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Desktop:&lt;/strong&gt; &lt;code&gt;100&lt;/code&gt; Performance, &lt;code&gt;100&lt;/code&gt; Accessibility, &lt;code&gt;100&lt;/code&gt; Best Practices, &lt;code&gt;100&lt;/code&gt; SEO (&lt;code&gt;LCP 0.4s&lt;/code&gt;, &lt;code&gt;CLS 0&lt;/code&gt;, &lt;code&gt;TBT 0ms&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mobile:&lt;/strong&gt; &lt;code&gt;99&lt;/code&gt; Performance, &lt;code&gt;100&lt;/code&gt; Accessibility, &lt;code&gt;100&lt;/code&gt; Best Practices, &lt;code&gt;100&lt;/code&gt; SEO (&lt;code&gt;LCP 1.1s&lt;/code&gt;, &lt;code&gt;CLS 0&lt;/code&gt;, &lt;code&gt;TBT 0ms&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Console errors across all interactive pages:&lt;/strong&gt; &lt;code&gt;0&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing fancy, just two small standalone tools that do one job cleanly. If you embed vanilla JS tools inside WordPress without a headless frontend, watch out for &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; entity encoding and test the boring paths on a real 390px viewport first. Curious to hear what subtle WordPress or browser quirks have cost you hours lately.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>webperf</category>
      <category>wordpress</category>
    </item>
  </channel>
</rss>
