bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 208 forks source link

Exclude Reload Paths #548

Open den1k opened 7 years ago

den1k commented 7 years ago

Figwheel allows to specify whether to reload .clj or .cljc files with :reload-clj-files. It would be great to be able to specify paths directories and files which to exclude from reload.

The Problem: Our app's styles are written in garden and contained in the watched source directory. When the styles are .cljc figwheel reloads twice, once for the garden file (which does nothing on our frontend), and a second time for the newly compiled css file by garden. This happens on every change to our css. Our current solution is to write styles in .clj and exclude them with :reload-clj-files. However, this causes all kinds of issues, disabling macro recompilation and forcing us to write macro files in .cljc. This is clearly a hack that won't scale.

Here are two ideas: On the file-level we could have a ^:figwheel-never ns flag contrasting ^:figwheel-always. In :figwheel-options we could have a :exclude-reload-paths.

bhauman commented 7 years ago

You can create another directory that is external to your cljs source-paths that you put your garden files in.

On Sun, Apr 16, 2017 at 6:56 AM, Dennis Heihoff notifications@github.com wrote:

Figwheel allows to specify whether to reload .clj or .cljc files with :reload-clj-files. It would be great to be able to specify paths directories and files which to exclude from reload.

The Problem: Our app's styles are written in garden and contained in the watched source directory. When the styles are .cljc figwheel reloads twice, once for the garden file (which does nothing on our frontend), and a second time for the newly compiled css file by garden. This happens on every change to our css. Our current solution is to write styles in .clj and exclude them with :reload-clj-files. However, this causes all kinds of issues, disabling macro recompilation and forcing us to write macro files in .cljc. This is clearly a hack that won't scale.

Here are two ideas: On the file-level we could have a ^:figwheel-never ns flag contrasting ^:figwheel-always. In :figwheel-options we could have a :exclude-reload-paths.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/lein-figwheel/issues/548, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQHLpR5OHWa30dDMd799mC-3QGmF3ks5rwh4jgaJpZM4M-oh8 .

den1k commented 7 years ago

We did that before. It prevented us from using some our styles inline and share colors, shape generators etc. across the codebase.

On Mon, Apr 17, 2017 at 1:03 AM Bruce Hauman notifications@github.com wrote:

You can create another directory that is external to your cljs source-paths that you put your garden files in.

On Sun, Apr 16, 2017 at 6:56 AM, Dennis Heihoff notifications@github.com wrote:

Figwheel allows to specify whether to reload .clj or .cljc files with :reload-clj-files. It would be great to be able to specify paths directories and files which to exclude from reload.

The Problem: Our app's styles are written in garden and contained in the watched source directory. When the styles are .cljc figwheel reloads twice, once for the garden file (which does nothing on our frontend), and a second time for the newly compiled css file by garden. This happens on every change to our css. Our current solution is to write styles in .clj and exclude them with :reload-clj-files. However, this causes all kinds of issues, disabling macro recompilation and forcing us to write macro files in .cljc. This is clearly a hack that won't scale.

Here are two ideas: On the file-level we could have a ^:figwheel-never ns flag contrasting ^:figwheel-always. In :figwheel-options we could have a :exclude-reload-paths.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/lein-figwheel/issues/548, or mute the thread < https://github.com/notifications/unsubscribe-auth/AAAKQHLpR5OHWa30dDMd799mC-3QGmF3ks5rwh4jgaJpZM4M-oh8

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/lein-figwheel/issues/548#issuecomment-294405628, or mute the thread https://github.com/notifications/unsubscribe-auth/AEb7ItmaOT6P7iwV8vxU6aJQdwDvjjR_ks5rwvKIgaJpZM4M-oh8 .

hkjels commented 7 years ago

I'm hitting this same issue. Have there been any progress?

den1k commented 7 years ago

@hkjels afaik, no

bhauman commented 7 years ago

There are more granular ways to determine what is compiled and what is watched for changes.

Read the docs here for :source-paths, :watch-paths, :compile-paths https://github.com/bhauman/lein-figwheel/blob/master/sidecar/src/figwheel_sidecar/schemas/config.clj#L498