olmokramer / atom-stylus-autocompile

Compile .styl files on save in Atom
MIT License
5 stars 4 forks source link

Imported .styl component needs to be saved twice to compile #6

Closed simrobin closed 9 years ago

simrobin commented 9 years ago

Hello,

I recently have discovered a problem with @imported .styl files, I thought I was the only one having this problem, but when I told my coworker to update the package (for the nib feature), they experienced the same problem.

When you are working on an @imported .styl file referencing to a main .styl file, you need to save the file twice in order to compile.

Step to reproduce :

main.styl :

 // out: main.css

@import 'component.styl';

body {
  margin: auto;
}

component.styl :

 // main: main.styl
 // main: main.styl

.my-class {
  display: none;
}

I'll try to look at it this week to see if I can find a clue.

olmokramer commented 9 years ago

Hmm, maybe this happens because the stylus compilation is started before the file is actually saved to disk? I can't test right now, but can you try to wrap a process.nextTick(function() { ... }) around the handleSave function?

simrobin commented 9 years ago

Ok I'll test it today and I'll let you know ! Thanks for the quick reply.

simrobin commented 9 years ago

Ok, my bad, it seems to be working since 0.3.1 due to commit https://github.com/olmokramer/atom-stylus-autocompile/commit/a6181dcb298c703ad5dd283517316a19dea6beed We updated and we are fine now. It's amazing when issues are solved before we found them !

olmokramer commented 9 years ago

It's amazing when issues are solved before we found them

Haha yeah I love it when that happens! Either as a user or a maintainer :D