segmentio / myth

A CSS preprocessor that acts like a polyfill for future versions of the spec.
4.32k stars 130 forks source link

CSS variables persisting #47

Closed jonathanKingston closed 10 years ago

jonathanKingston commented 10 years ago

So I made a sample site for testing Myth: MythHub

However I have noticed that variables persist across conversions, to replicate this you can delete or rename the variable green and it will still be operational in the converted code.

Effectively the code is doing:

var myth = require('myth');
  function updateCSS(css) {
    try {
      converted = myth(css);
    } catch(e) {
...
    }
    toTextElement.value = converted.trim();
  }

Which means somewhere within the myth or library code base those variables are being stored and not removed.

ianstormtaylor commented 10 years ago

sweet site!

just pushed a fix for this, thanks for catching it! https://github.com/segmentio/myth/commit/e22b58562c6285a38d95b7fa5d3afc8a52764c8a

jonathanKingston commented 10 years ago

@ianstormtaylor thanks; I completely missed this until today.

I have just updated the site with the latest version; it appears to cause a fatal exception as expected thank you.

MoOx commented 10 years ago

It can be a good idea to integrate this playground on the official website or at least mention it, don't you think guys ?

jonathanKingston commented 10 years ago

@MoOx Sounds worthwhile as that was my motivation to writing it really, that I couldn't see its use until it was in real time. I will tidy it up and make it embeddable onto the main site; I have just finished a quick text editor using rework which would allow for the same code highlight styling as on the Myth site in realtime. I should have this complete tonight.

MoOx commented 10 years ago

Awesome ! :shipit: