Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CypherPotato committed Oct 20, 2023
1 parent 0fd2e2d commit b45bbb4
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 21 deletions.
5 changes: 3 additions & 2 deletions src/Cascadium.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Cascadium</RootNamespace>
<AssemblyName>Cascadium.Core</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>

<Title>Cascadium</Title>
<PackageId>Cascadium</PackageId>
<Title>Cascadium Compiler</Title>
<PackageId>Cascadium.Compiler</PackageId>

<Authors>CypherPotato</Authors>
<Company>Project Principium</Company>
Expand Down
25 changes: 18 additions & 7 deletions src/Converters/StaticCSSConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,28 @@ public override Boolean CanConvert(String propertyName, String value)
/// <inheritdoc/>
public override void Convert(String? value, NameValueCollection outputDeclarations)
{
string[] arguments = SafeSplit(value);
foreach (KeyValuePair<string, string> pair in Output)
if (ArgumentCount != null)
{
string newValue = pair.Value;
string[] arguments = SafeSplit(value);
foreach (KeyValuePair<string, string> pair in Output)
{
string newValue = pair.Value;

for (int i = 0; i < arguments.Length; i++)
{
newValue = newValue.Replace("$" + (i + 1), arguments[i]);
}

for (int i = 0; i < arguments.Length; i++)
outputDeclarations.Add(pair.Key, newValue);
}
}
else
{
foreach (KeyValuePair<string, string> pair in Output)
{
newValue = newValue.Replace("$" + (i + 1), arguments[i]);
string newValue = pair.Value.Replace("$*", value);
outputDeclarations.Add(pair.Key, newValue);
}

outputDeclarations.Add(pair.Key, newValue);
}
}
}
2 changes: 1 addition & 1 deletion tests/build/CssTests/CssTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\SimpleCSSCompiler.csproj" />
<ProjectReference Include="..\..\..\src\Cascadium.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions tool/Cascadium-Utility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

<AssemblyVersion>0.1.0.1</AssemblyVersion>
<FileVersion>0.1.0.1</FileVersion>
<RootNamespace>csssimple</RootNamespace>
<RootNamespace>cascadiumtool</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\Cascadium.csproj" />
<ProjectReference Include="..\src\Cascadium.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tool/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace cssimple;
namespace cascadiumtool;

internal class CommandLineArguments
{
Expand Down
3 changes: 2 additions & 1 deletion tool/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace cssimple;
namespace cascadiumtool;

internal class Compiler
{
Expand All @@ -31,6 +31,7 @@ public static int RunCompiler(CommandLineArguments args)
Pretty = args.Pretty == BoolType.True,
UseVarShortcut = args.UseVarShortcuts == BoolType.True,
KeepNestingSpace = args.KeepNestingSpace == BoolType.True,
Merge = args.Merge == BoolType.True
};

Program.CompilerOptions?.ApplyConfiguration(options);
Expand Down
2 changes: 1 addition & 1 deletion tool/JsonCompilerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using System.Text.Json;
using System.IO;

namespace cssimple;
namespace cascadiumtool;

[JsonSerializable(typeof(ICollection<string>))]
[JsonSerializable(typeof(string))]
Expand Down
4 changes: 2 additions & 2 deletions tool/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace cssimple;
namespace cascadiumtool;
internal static class Log
{
public static bool LoggingEnabled { get; set; } = true;
Expand All @@ -23,6 +23,6 @@ public static int Info(string message, bool force=false)

private static void Write(string level, string message)
{
Console.WriteLine("xcss {0,5}: {1}", level, message);
Console.WriteLine("cascadium {0,5}: {1}", level, message);
}
}
2 changes: 1 addition & 1 deletion tool/PathUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace cssimple;
namespace cascadiumtool;
internal static class PathUtils
{
private const int UnitKb = 1024;
Expand Down
2 changes: 1 addition & 1 deletion tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Diagnostics.CodeAnalysis;
using System.IO;

namespace cssimple;
namespace cascadiumtool;

internal class Program
{
Expand Down
9 changes: 7 additions & 2 deletions tool/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace cssimple;
namespace cascadiumtool;

internal static class Watcher
{
Expand Down Expand Up @@ -40,6 +40,11 @@ public static int Watch(CommandLineArguments args)
watchingDirectories = paths.ToArray();
foreach (string p in paths)
{
if(!Directory.Exists(p))
{
return Log.ErrorKill("the detected directory path at " + p + " does not exists.");
}

if (smallestPath == null || p.Length < smallestPath.Length)
{
smallestPath = p;
Expand All @@ -53,7 +58,7 @@ public static int Watch(CommandLineArguments args)
fsWatcher.IncludeSubdirectories = true;
fsWatcher.EnableRaisingEvents = true;

Log.Info("xcss is watching for file changes");
Log.Info("cascadium is watching for file changes");
Log.LoggingEnabled = false;

Compiler.RunCompiler(args);
Expand Down
26 changes: 26 additions & 0 deletions tool/xcss.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>xcss</AssemblyName>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun>
<InvariantGlobalization>true</InvariantGlobalization>

<AssemblyVersion>1.0.7.14</AssemblyVersion>
<FileVersion>1.0.7.14</FileVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\SimpleCSSCompiler.csproj" />
</ItemGroup>

</Project>

0 comments on commit b45bbb4

Please sign in to comment.