reagent-project / reagent-template

A Leiningen template for projects using Reagent.
MIT License
394 stars 55 forks source link

Less profile #53

Closed petrvolny closed 9 years ago

petrvolny commented 9 years ago

Hi, I've tried to integrate the template with lein-less and create the new +less profile. I tested the implementation and it (partly) works :) I managed to have a nice dev env when runing lein-figwheel and lein less auto separately. The last thing I was not able to implement was auto compiling less files with just running lein figwheel. Any help? :)

Related to: #47

yogthos commented 9 years ago

Looks good so far, you probably have to create a hook using lein-less, something like :hooks [leiningen.less] would watch for changes and trigger less recompile that should generate new css that figwheel will reload.

petrvolny commented 9 years ago

Thanks for the tip! I've tried to put the hook pretty much everywhere but with no effect. The less auto-compile feature only worked with the lein ring server task but not with the lein figwheel. I've also tried the feature on chestnut but wasn't able make it auto-compile less files either.

Maybe I am overlooking something trivial. I've found plugin called lein-cascade which might be handy in triggering tasks cascade style but I am not sure if it is a good fit for this problem. Please, let me know what do you think.

yogthos commented 9 years ago

I think what's happening is that the less hook runs only once a profile is loaded, but doesn't stick around to watch for changes. Since figwheel's not aware of less files it doesn't trigger any recompiles. Perhaps using lein-auto together with lein-less might work.

If you start lein-auto in the :dev profile and then it should call lein-less that would compile the less assets and that in turn should generate new css that figwheel will reload.

petrvolny commented 9 years ago

Sorry for a little delay. I tried the lein-auto solution but still cannot get rid of the fact that I need to run lein auto separately after running lein figwheel. Still no clue how to integrate a separate lein task with figwheel :(

yogthos commented 9 years ago

I think running both lein-auto and lein-figwheel might be the best case scenario. I looked at the chestnut template for Om, and it doesn't solve the problem either from what I can tell.

petrvolny commented 9 years ago

Ok, so now it works in a way that you need to run lein figwheel and lein less auto separately to automatically compile less files to css. Is it ok for you?

yogthos commented 9 years ago

I think that's a reasonable solution, if you update the pr so it automerges, I can push out a new release with the changes. :)

petrvolny commented 9 years ago

Done :)

yogthos commented 9 years ago

ok latest and greatest up on clojars, thanks for the pr :)

petrvolny commented 9 years ago

Thanks for your guidence on this one ;)

yogthos commented 9 years ago

@petrvolny so I just found out about lein-pdo that solves the problem. With it you can create an alias like:

:aliases {"dev"  ["pdo" "less" " "auto," "figwheel"]}

and it'll start both tasks in parallel