• Resolved wuguishifu

    (@wuguishifu)


    I have code that I’m using to display text, for example:
    console.log(`Answer: ${answer}`);
    where the space is specifically required. However, in the “optimized” code produced by HFCM, the space is removed. This breaks functionality and is not optimal. Is there a way to fix this?

    • This topic was modified 2 years, 6 months ago by wuguishifu.
    • This topic was modified 2 years, 6 months ago by wuguishifu.
    • This topic was modified 2 years, 6 months ago by wuguishifu.
    • This topic was modified 2 years, 6 months ago by wuguishifu.
    • This topic was modified 2 years, 6 months ago by wuguishifu.
    • This topic was modified 2 years, 6 months ago by wuguishifu.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author DraftPress Team

    (@draftpress)

    Hi @wuguishifu – We tested this on our end. It’s working fine for us and space is not being removed. You can see the screenshot of that here – https://prnt.sc/N6KPRZd-lNi0

    Please send us a screen recording to show what’s happening for you?

    Thanks a lot.

    Thread Starter wuguishifu

    (@wuguishifu)

    Hi @draftpress
    Here’s the first example I have in a helper function.
    My code is written as return `${style} ${size} px Open Sans`; (https://prnt.sc/mki-6b5fpJHH) but the produced JS file (the one I found via inspect element) shows return`${style}${size}px Open Sans`; (https://prnt.sc/ku8rPrQVt6T_).

    Another example:
    My code, with space: https://prnt.sc/QhNLvTDTDFVS
    generated code, no space: https://prnt.sc/gEEifU1nVNgI
    and this is the actual output: https://prnt.sc/A5jP1dquIiho, which should say ‘Density: 11.5 g/mL’ (with spaces).

    The code works perfectly fine on my own test server, and outputs properly with spaces. It’s just when I try to use the HFCM plugin it doesn’t. I think it may be an issue with the close brace template literals, because spaces don’t get removed in template literals after normal characters, but they do get removed after the close brace character.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘“Optimized Code” gets rid of things like spaces’ is closed to new replies.