Ideas #24
Explosion-Scratch
started this conversation in
Ideas
Ideas
#24
Replies: 3 comments
-
Thanks for the suggestions! Many of the things you have suggested we plan to add in future releases. The built-in color palette will definitely be the first. You can already create advanced mixins in JavaScript https://asmcss.com/docs/1.x/mixins.html#javascript-mixins |
Beta Was this translation helpful? Give feedback.
0 replies
-
Cool! Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Update: Functional async compile function, (Just works for the time being, I'm sure a native one could be synchronous and way faster.) function compile(css) {
return new Promise((resolve) => {
//Create elements and stuff
var container = document.createElement("div");
//Just in case IE doesn't support something.
container.setAttribute("style", "display: none !important; position: absolute !important; top: -99999999px !important; left: -9999999px !important; overflow: hidden !important; width: 0 !important; height: 0 !important; visibility: none !important;");
var d = document.createElement("div");
d.setAttribute("x-style", css);
container.appendChild(d);
document.body.appendChild(container);
var observer = new MutationObserver(function (mutations, me) {
for (const mutation of mutations) {
if (
mutation.type === "attributes" &&
mutation.attributeName === "style"
) {
resolve(d.getAttribute("style"));
me.disconnect();
}
}
});
observer.observe(d, {
attributes: true
});
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I really love this project and I had a few ideas for it:
lighten(@${0}, 20)
(out of 100)<x-style>
tag supporting css-like syntax something like this:Beta Was this translation helpful? Give feedback.
All reactions