Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cassius/Lucius changes trigger recompilation #1425

Closed
alx741 opened this issue Jul 30, 2017 · 11 comments
Closed

Cassius/Lucius changes trigger recompilation #1425

alx741 opened this issue Jul 30, 2017 · 11 comments

Comments

@alx741
Copy link
Contributor

alx741 commented Jul 30, 2017

When a change is made in a cassius or lucius file, the change takes effect immediately and can be observed if the page is refresh within <1s after saving the change to the file (time in which yesod devel hasn't started recompilation yet). Although the change takes effect, yesod devel detects the change in the file system and triggers recompilation of the module that invokes the template file, forcing a ~10s unnecessary wait on the The application isn’t built page.

After saving the change in the template file, the output of yesod devel is:

[ 9 of 11] Compiling Handler.Home ( src/Handler/Home.hs, .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/build/Handler/Home.o ) [templates/homepage.lucius changed]

Followed by usual recompilation output.

A few months ago a change in a cassius or lucius file didn't use to trigger recompilation (reload mode).
Not sure if this new behavior arises from a yesod-bin, or scaffolding update though.

@alx741
Copy link
Contributor Author

alx741 commented Jul 30, 2017

After some catching up with yesod-bin latest changes, I think this behavior emerges from the use of stack's --file-watch, which triggers recompilation on every file change, including cassius and lucius templates even though is not needed.

Edit: By using yesod-bin 1.4.18.7 (commit: 1aed870) the recompilation does occur for hamlet changes but doesn't for cassius, lucius, julius changes. Just as expected.

@snoyberg
Copy link
Member

I do not reproduce this. Stack tracks which files to rebuild based on addDependentFile usage, which is not used for the reload versions of cassius, lucius, and julius. Are you able to reproduce this with a freshly scaffolded site?

@alx741
Copy link
Contributor Author

alx741 commented Jul 30, 2017

Yes, I just created a new instance of the scaffolding with:

stack new someyesod yesod-postgres
stack build yesod-bin cabal-install --install-ghc
stack build
stack exec -- yesod devel

And the recompilation occurs on every cassius and julius file change. But I'm able to see the changes reflected in the browser if I refresh really fast (before recompilation begins), just as described above.

Does this not happen to you in the scaffolded site? Could it be that I'm doing something wrong but not seeing it (?)

@psibi
Copy link
Member

psibi commented Jul 30, 2017

@alx741 Curious to know what version of yesod-bin are you using. You can run this under your project to get it:

 $ stack exec yesod -- version
yesod-bin version: 1.5.2.2

@alx741
Copy link
Contributor Author

alx741 commented Jul 30, 2017

@psibi

stack exec yesod -- version

yesod-bin version: 1.5.2.3

stack --version

Version 1.5.0 x86_64
Compiled with:

  • Cabal-1.24.2.0
    .....

Running Archlinux
uname -a

Linux amy 4.12.3-1-ARCH #1 SMP PREEMPT Sat Jul 22 15:32:02 UTC 2017 x86_64 GNU/Linux

@alx741
Copy link
Contributor Author

alx741 commented Jul 30, 2017

Not sure if relevant, but just in case:
ag -h "addDependent" gave me (in a fresh scaffolded site)

.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/build/src/Handler/Home.dump-hi
384:addDependentFile "templates/homepage.lucius"
385:addDependentFile "templates/homepage.julius"
386:addDependentFile "templates/homepage.hamlet"
387:addDependentFile "templates/homepage.lucius"
388:addDependentFile "templates/homepage.julius"
389:addDependentFile "templates/homepage.hamlet"

@snoyberg
Copy link
Member

snoyberg commented Jul 31, 2017 via email

@alx741
Copy link
Contributor Author

alx741 commented Jul 31, 2017

Have a couple projects, the same behavior occurs in all of them. These are the resolvers I got:

  • lts-6.35
  • lts-8.13
  • lts-8.19
  • lts-9.0

Edit: yesod-bin 1.5.2.3 in all of them

@alx741
Copy link
Contributor Author

alx741 commented Jul 31, 2017

So I just freshly installed Ubuntu 16.04 in a virtual machine, then tried with a fresh scaffolded site, and observed the same behavior (needless recompilation after cassius, lucius templates changes)

@snoyberg
Copy link
Member

snoyberg commented Aug 6, 2017 via email

@alx741
Copy link
Contributor Author

alx741 commented Aug 6, 2017

@snoyberg thanks, I was trying to track it down by understanding how Stack handles that stuff (with little success), will take a look into Shakespeare.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants