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

Can only get to work using as a Tool #17

Closed
michael-kaufman opened this issue Oct 26, 2020 · 3 comments
Closed

Can only get to work using as a Tool #17

michael-kaufman opened this issue Oct 26, 2020 · 3 comments

Comments

@michael-kaufman
Copy link

michael-kaufman commented Oct 26, 2020

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
Copy link
Member

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
Copy link
Author

michael-kaufman commented Oct 26, 2020 via email

@michael-kaufman
Copy link
Author

michael-kaufman commented Oct 26, 2020 via email

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

2 participants