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

Sample PR with tailwind #50

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

jirisykora83
Copy link

As you wrote on twitter, that you may want to try tailwind i make this simple setup with same ui.

This bring another requirement to have install tailwindcss.

npm install -D tailwindcss

Then via csproj i add building tailwind with each dotnet build (not sure how it works with hot reload).

Minify non-compress version of final css is about 15kb vs 159kb with bootstrap.

image

image

PS: sorry for converting few spaces to tabs i have some VS plugin and project do not have EditorConfig file with spaces

@davidfowl
Copy link
Owner

davidfowl commented Dec 4, 2022

This bring another requirement to have install tailwindcss.

npm install -D tailwindcss

Then via csproj i add building tailwind with each dotnet build (not sure how it works with hot reload).

I'm not a fan of this requirement. it does look nice though!

@jirisykora83
Copy link
Author

There are a few options on how it can be built.

  1. Install tailwindcss "globaly"
  2. use it as part of webpack (via postCSS)
  3. standalone CLI (included in repo?)

  1. i also found dotnet tool https://www.nuget.org/packages/tailwindcss.cli#readme-body-tab which maybe can be utilize (it should use tailwind.cli under the hood).

@duaneedwards
Copy link

If you use the tailwindcss.cli dotnet tool nuget package you can remove the node requirement completely.

I'd recommend a local tool install, and not a global install (dotnet tool install --local tailwindcss.cli)

Should you head down that route, I'd also recommend looking at the tailwindcss.msbuild nuget package which helps integrate the dotnet tool with msbuild. In my projects I usually opt for the 'Project file mode' configuration method where you simply add the cli arguments to your csproj like this:

<PropertyGroup>
    <TailwindCSSReleaseBuildArguments>-i input.css -o wwwroot/css/output.css --minify</TailwindCSSReleaseBuildArguments>
    <TailwindCSSDebugBuildArguments>-i input.css -o wwwroot/css/output.css</TailwindCSSDebugBuildArguments>
</PropertyGroup>

The only real clunky part of this is the dance required to insure the dotnet tool is actually installed. (dotnet restore does not restore dotnet tools)

There's a couple of issues around this dotnet restore behaviour that have some workarounds that you can refer to:

I'll probably open source the tailwindcss.cli and tailwindcss.msbuild packages in the future, I just need to do a pass to make sure I haven't committed any secrets and clean up a few things first.

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

Successfully merging this pull request may close these issues.

None yet

3 participants