<Project Sdk="Microsoft.NET.Sdk.Razor">

	<PropertyGroup>
		<TargetFramework>net7.0</TargetFramework>
		<Nullable>enable</Nullable>
		<ImplicitUsings>enable</ImplicitUsings>
		<RootNamespace>Connected</RootNamespace>
		<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
		<Title>$(AssemblyName)</Title>
		<Authors>Tom PIT ltd</Authors>
		<Copyright>2022 Tom PIT ltd</Copyright>
		<PackageProjectUrl>https://git.tompit.com/Connected/Info</PackageProjectUrl>
		<PackageReadmeFile>README.md</PackageReadmeFile>
		<PackageTags>connected;platform;</PackageTags>
		<IncludeSymbols>True</IncludeSymbols>
		<SymbolPackageFormat>snupkg</SymbolPackageFormat>
		<PackageLicenseFile>LICENSE</PackageLicenseFile>
		<PackageOutputPath>$(OutputPath)</PackageOutputPath>
	</PropertyGroup>

	<ItemGroup>
		<None Include="compilerconfig.json" />
		<None Include="Components\DatePicker.razor" />
	</ItemGroup>

	<ItemGroup>
		<SupportedPlatform Include="browser" />
	</ItemGroup>

	<ItemGroup>
		<PackageReference Include="Microsoft.AspNetCore.Components" Version="7.0.3" />
		<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.*-*" />
	</ItemGroup>

	<ItemGroup>
		<None Include="..\..\LICENSE">
			<Pack>True</Pack>
			<PackagePath>\</PackagePath>
		</None>
		<None Include="..\..\README.md">
			<Pack>True</Pack>
			<PackagePath>\</PackagePath>
		</None>
	</ItemGroup>

	<ItemGroup>
	  <Content Update="version.json">
	    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
	  </Content>
	</ItemGroup>

	<Target Name="ToolRestore">
		<Exec Command="dotnet tool restore" StandardOutputImportance="high" />
	</Target>

	<Target Name="WebCompiler" DependsOnTargets="ToolRestore;">
		<!--compile and minify scss-->
		<Exec Command="dotnet webcompiler ./Styles/Connected.Components.scss -c excubowebcompiler.json" StandardOutputImportance="high" StandardErrorImportance="high" />
	</Target>

	<Target Name="IncludeGeneratedStaticFiles" DependsOnTargets="WebCompiler" BeforeTargets="BeforeBuild">
		<Error Condition="!Exists('$(MSBuildProjectDirectory)/wwwroot/Connected.Components.min.css')" Text="Missing Connected.Components.min.css in wwwroot" />
		<ItemGroup>
			<!--Include without duplication-->
			<_NewCompiledCssFiles Include="wwwroot\Connected.Components.min.css" Exclude="@(Content)" />
			<Content Include="@(_NewCompiledCssFiles)" />
		</ItemGroup>
	</Target>

	<Target Name="Delete sass/js compiler artifacts" AfterTargets="AfterBuild">
		<Delete Files="./Styles/Connected.Components.css" />
		<Delete Files="./Styles/Connected.Components.min.css" />
	</Target>
	
	<ItemGroup>
		<Watch Include="**/*.scss" />
	</ItemGroup>


	<ItemGroup>
	  <Watch Remove="Styles\Connected.Components.scss" />
	</ItemGroup>

	<ItemGroup>
	  <Content Include=".config\dotnet-tools.json" />
	</ItemGroup>
</Project>
