I have this javascript code I want to minify.Users are meant to embed it in the head of their website. It's purely written in javascript. I however embedded come css code within the js file. I tried minifying on the website https://jscompress.com/ but it keeps throwing the error
File index.js: Unexpected character '`' (line: 1, col: 13)
Does anyone know an alternative to implementing my css codes in javascript file without "`" symbols.
Here is my code:
var styles = `
.info{
display: flex;
color: black;
font-size: xx-small;
margin-left: 5px;
}
.text{
margin-top: 12;
}
.verification {
display: flex;
flex-direction: horizontal;
justify-content: center;
align-items: center;
width: 80px;
height: 50px;
background-color: white;
color: white;
padding: 6px 6px;
margin: 8px 0;
border: 1px solid green;
border-radius: 4px;
cursor: pointer;
z-index: 500px;
// opacity: 0.5;
box-shadow: 5px 5px #d0dcd0;
}
.link {
text-decoration: none;
color: green;
}
`
var styleSheet = document.createElement("style")
styleSheet.type = "text/css"
styleSheet.innerText = styles
document.head.appendChild(styleSheet);
window.onload = function () {
var div = document.createElement("div");
div.style.position = "absolute";
div.style.left = "10px";
div.style.bottom = "10px";
div.innerHTML = "<div class='verification'><div class='img'><img height='30px' src='https://upload.wikimedia.org/wikipedia/commons/a/ab/Android_O_Preview_Logo.png' /></div><div class='info'><p > Verified by Champ <a class='link' href='#'>Learn more</a> </p</div><div>";
var lastChild = document.body.lastChild;
document.body.insertBefore(div, lastChild.nextSibling);
};
