excubo-ag / WebCompiler

Apache License 2.0
149 stars 30 forks source link

Can only get to work using as a Tool #17

Closed michael-kaufman closed 3 years ago

michael-kaufman commented 3 years ago

Hi. Thank you for the tool. It's great but I can only get this to work as a Tool. I've installed it globally and use it in a Watch using this:
dotnet watch tool run webcompiler -r -z disabled -m disabled -o wwwroot/converted Styles

Also, there's an issue that when you supply an output directory. It works, but you're left with two versions of the same file. One from where it originated, and another in the output folder.

Questions:

  1. Can it be used in a watch AND on Save AND in the build simultaneously? I can only get it to work as a Tool and a Watcher.
  2. Why does it only work recursively, using the -r flag?
  3. Is there a way to make it auto refresh the page after it converts files? I tried with LiveReload, but it seems to break everything.

Thanks! -MK

stefanloerwald commented 3 years ago

Hi @michael-kaufman,

It's great but I can only get this to work as a Tool.

I don't understand what you mean by that. This is literally a dotnet tool, so I don't know what else you would like to use it as.

Also, there's an issue that when you supply an output directory.

There isn't. You are looking for --preserve disable to not preserve the intermediate files. This comes at a downside of increased compile time, as there is less caching.

  1. Can it be used in a watch AND on Save AND in the build simultaneously? I can only get it to work as a Tool and a Watcher.

I am not familiar with dotnet watch, so can't help with that. Sorry! I'm sure you can write MSBuild targets to enable "build on save". The important bit will be to find out which Target to make your Target depend on. Maybe you want something like

    <Target Name="CompileStaticAssets" AfterTargets="CoreCompile">
        <Exec Command="dotnet tool run webcompiler ..." StandardOutputImportance="high" />
    </Target>

The exact config is up to you, and maybe CoreCompile is not the right target for you. Not sure..

  1. Why does it only work recursively, using the -r flag?

This is literally what -r means. It is equivalent to --recursive. If we were to recurse without that flag, many people would be annoyed because they don't actually want that.

  1. Is there a way to make it auto refresh the page after it converts files? I tried with LiveReload, but it seems to break everything.

That's very much out of scope for webcompiler. As far as I know, you could probably achieve that with dotnet watch, by adding the output files to the watch.

Hope that helps Stefan

michael-kaufman commented 3 years ago

Hi Stefan,

Thank you!! That gives me new things to try. Thanks very much for the fast response too!! I am not really a .net developer but way more a .js guy which is probably why I'm having problems. You're right about the Tool. Sorry, I worded that wrong. I meant I can only get it to work on the command line but not in the build or on saving. I am going to try different things now. I really appreciate the help.

Michael.

On Mon, Oct 26, 2020 at 1:27 PM Stefan Lörwald notifications@github.com wrote:

Hi @michael-kaufman https://github.com/michael-kaufman,

It's great but I can only get this to work as a Tool.

I don't understand what you mean by that. This is literally a dotnet tool, so I don't know what else you would like to use it as.

Also, there's an issue that when you supply an output directory.

There isn't. You are looking for --preserve disable to not preserve the intermediate files. This comes at a downside of increased compile time, as there is less caching.

  1. Can it be used in a watch AND on Save AND in the build simultaneously? I can only get it to work as a Tool and a Watcher.

I am not familiar with dotnet watch, so can't help with that. Sorry! I'm sure you can write MSBuild targets to enable "build on save". The important bit will be to find out which Target to make your Target depend on. Maybe you want something like

<Target Name="CompileStaticAssets" AfterTargets="CoreCompile">
    <Exec Command="dotnet tool run webcompiler ..." StandardOutputImportance="high" />
</Target>

The exact config is up to you, and maybe CoreCompile is not the right target for you. Not sure..

  1. Why does it only work recursively, using the -r flag?

This is literally what -r means. It is equivalent to --recursive. If we were to recurse without that flag, many people would be annoyed because they don't actually want that.

  1. Is there a way to make it auto refresh the page after it converts files? I tried with LiveReload, but it seems to break everything.

That's very much out of scope for webcompiler. As far as I know, you could probably achieve that with dotnet watch, by adding the output files to the watch.

Hope that helps Stefan

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/excubo-ag/WebCompiler/issues/17#issuecomment-716772464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMLJ7XOCYICCVMFNOIQ45LSMXERLANCNFSM4S7ZGWYQ .

michael-kaufman commented 3 years ago

Stefan,

I got it working using AfterTargets="Compile". And it works with LiveReload too. So now I make a CSS change and hit Save and it takes care of refreshing the page. Thanks for the perfect tool!!

Best, MK

On Mon, Oct 26, 2020 at 1:45 PM Michael Kaufman mkaufmandev@gmail.com wrote:

Hi Stefan,

Thank you!! That gives me new things to try. Thanks very much for the fast response too!! I am not really a .net developer but way more a .js guy which is probably why I'm having problems. You're right about the Tool. Sorry, I worded that wrong. I meant I can only get it to work on the command line but not in the build or on saving. I am going to try different things now. I really appreciate the help.

Michael.

On Mon, Oct 26, 2020 at 1:27 PM Stefan Lörwald notifications@github.com wrote:

Hi @michael-kaufman https://github.com/michael-kaufman,

It's great but I can only get this to work as a Tool.

I don't understand what you mean by that. This is literally a dotnet tool, so I don't know what else you would like to use it as.

Also, there's an issue that when you supply an output directory.

There isn't. You are looking for --preserve disable to not preserve the intermediate files. This comes at a downside of increased compile time, as there is less caching.

  1. Can it be used in a watch AND on Save AND in the build simultaneously? I can only get it to work as a Tool and a Watcher.

I am not familiar with dotnet watch, so can't help with that. Sorry! I'm sure you can write MSBuild targets to enable "build on save". The important bit will be to find out which Target to make your Target depend on. Maybe you want something like

<Target Name="CompileStaticAssets" AfterTargets="CoreCompile">
    <Exec Command="dotnet tool run webcompiler ..." StandardOutputImportance="high" />
</Target>

The exact config is up to you, and maybe CoreCompile is not the right target for you. Not sure..

  1. Why does it only work recursively, using the -r flag?

This is literally what -r means. It is equivalent to --recursive. If we were to recurse without that flag, many people would be annoyed because they don't actually want that.

  1. Is there a way to make it auto refresh the page after it converts files? I tried with LiveReload, but it seems to break everything.

That's very much out of scope for webcompiler. As far as I know, you could probably achieve that with dotnet watch, by adding the output files to the watch.

Hope that helps Stefan

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/excubo-ag/WebCompiler/issues/17#issuecomment-716772464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMLJ7XOCYICCVMFNOIQ45LSMXERLANCNFSM4S7ZGWYQ .