Hello.
I’m trying to create custom outputs and having some problem with the same.
I have the following in the config.toml
:
[outputFormats]
[outputFormats.Logic]
baseName = "logic"
mediaType = "application/javascript"
path = "js"
[outputs]
home = ["HTML", "Logic"]
Then, I have my JavaScript code in layouts/index.logic.js
. In that file, I have a comparision operation like this: if (window.innerWidth < 640) {... /* rest of the code */ ...}
, however, while exporting (and in server), that condition is getting converted to if (window.innerWidth < 640) {... /* rest of the code */ ...}
which is causing a syntax error in JavaScript. I tried changing the condition like if (window.innerWidth >= 640) {... /* rest of the code */ ...}
and then, it worked but the next condition then got its characters escaped which were previously fine. I also tried creating another layout and added a simple code: if (1 > 2) {alert("hello")}
and the characters didn’t get escaped here.
I’ve no clue what I’m doing wrong.
Here’s the repo: https://github.com/Hrishikesh-K/Portfolio/tree/v2