bambutz / msbuild-tailwindcss Goto Github PK
View Code? Open in Web Editor NEWAdds a build action to process stylesheets through postcss/tailwind
License: MIT License
Adds a build action to process stylesheets through postcss/tailwind
License: MIT License
Hi there,
I installed your package in a fresh .NET 6 razor page app, but when running dotnet run
, it fails with the following error:
EXEC : Input error : Must use --dir or --replace with multiple input files [XX.csproj]
/Users/alex/.nuget/packages/bambutz.msbuild.tailwindcss/1.3.1/build/BamButz.MSBuild.TailwindCSS.targets(50,9): error MSB3073: The command "npm run postcss -- "" --config "/Users/alex/.nuget/packages/bambutz.msbuild.tailwindcss/1.3.1/build/../" -o ".min.css"" exited with code 1.
Not sure how I can debug this – perhaps someone could poke me in the right direction?
Thank you!
I have a config.js in the root of the project but it doesn't seem to be apply my config but building the css file works fine.
It works when I build the same project on Linux (Rider and dotnet cli) but doesn't work on Windows (Visual Studio and dotnet cli). My colleague also has the same issue on his machine.
Some home debugging this would be appreciated 😄
Currently, the package is installing the NPM packages inside his specific NuGet package folder (E.g. C:\Users\USER\.nuget\packages\BamButz.MSBuild.TailwindCSS\VERSION) this should be changed to a specific folder that will be used by all future versions.
I could imagine that this could be solved via a task in C#, but an implementation directly in the targets would also be sufficient.
I received a request for how to use a custom configuration.
It should be sufficient to create a tailwind.config.js in the project and use it in the PostCSS call if available.
This is really a dup of #11, but I have hit the same problem myself, and I saw someone else did yesterday, and I've worked through what it is.
There are two places in the .targets file which invoke NPM, like this:
Command=""$(NodeCli)" install"
This gives the same result as if one went to the command line and typed
"npm" install
Unfortunately, this command (with the quotes around npm) will not work - npm/node is invoked, but fails to run, with the sort of error messages which people are reporting in #11. I have not bothered to get to the bottom of this - presumably the double quotes cause something to fail in the npm command-line parsing process.
Anyway, for me, just changing the two places in the .targets file to remove the "
parts has made things work.
Given that the target already makes the assumption that you can just run node -v
to check for the presence of Node somewhere on the path, it's probably safe to assume that you can also run npm install
, at least in most normal circumstances.
I will put in a PR if it's helpful, but there probably was a reason why the "
got added, so maybe they need to stay in there but be moved somewhere else?
Thank you for providing that package. Not having to use a package.json is a huge benefit.
Unfortunately it does not work in my case because the system builds a styles.min.css file which does not have the needed classes.
is it possible that the tailwind config does not support .cshtml files?
I got the error message when I compiler project
Cannot find module 'D:\Projects\Demo1\packages\BamButz.MSBuild.TailwindCSS.1.3.0\node_modules\npm\bin\npm-cli.js'
Cowell.eWebNet.Apps.eWebFront D:\Projects\Demo1\EXEC
I get that this would automate the npm part of the build during .NET build process, but how would you deal with incremental builds during development?
The build process fails because the plugin is looking for NPM / Modues in the wrong directory ...
NPM together with Tailwind is installed in relation to the SLN file .. maybe this plugin should look for that ?
Rebuild started...
1>------ Rebuild All started: Project: ParkWebApp.Shared, Configuration: Debug Any CPU ------
1> ParkWebApp.Shared -> C:\develop\Parkerings-MobilWebApp\ParkWebApp.Shared\bin\Debug\ParkWebApp.Shared.dll
2>------ Rebuild All started: Project: ParkWebApp, Configuration: Debug Any CPU ------
3>------ Rebuild All started: Project: ParkWebApp.Api, Configuration: Debug Any CPU ------
2> CompileTailwindCSS: Cleaning
2> CompileTailwindCSS: Cleaning C:\develop\Parkerings-MobilWebApp\packages\BamButz.MSBuild.TailwindCSS.1.3.0\build../pa
2> ckage-lock.json
2> CompileTailwindCSS: Cleaning C:\develop\Parkerings-MobilWebApp\packages\BamButz.MSBuild.TailwindCSS.1.3.0\build../ta
2> ilwind.config.js
2> ParkWebApp -> C:\develop\Parkerings-MobilWebApp\ParkWebApp\bin\ParkWebApp.dll
2> internal/modules/cjs/loader.js:883
2> throw err;
2> ^
2>
2>EXEC : error : Cannot find module 'C:\develop\Parkerings-MobilWebApp\packages\BamButz.MSBuild.TailwindCSS.1.3.0\node_mo
2>dules\npm\bin\npm-cli.js'
2> at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
2> at Function.Module._load (internal/modules/cjs/loader.js:725:27)
2> at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
2> at internal/main/run_main_module.js:17:47 {
2> code: 'MODULE_NOT_FOUND',
2> requireStack: []
2> }
2> internal/modules/cjs/loader.js:883
2> throw err;
2> ^
2>
2>EXEC : error : Cannot find module 'C:\develop\Parkerings-MobilWebApp\packages\BamButz.MSBuild.TailwindCSS.1.3.0\node_mo
2>dules\npm\bin\npm-cli.js'
2> at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
2> at Function.Module._load (internal/modules/cjs/loader.js:725:27)
2> at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
2> at internal/main/run_main_module.js:17:47 {
2> code: 'MODULE_NOT_FOUND',
2> requireStack: []
2> }
2>C:\develop\Parkerings-MobilWebApp\packages\BamButz.MSBuild.TailwindCSS.1.3.0\build\BamButz.MSBuild.TailwindCSS.targets(
2>31,9): error MSB3073: The command ""npm" install" exited with code 1.
3> ParkWebApp.Api -> C:\develop\Parkerings-MobilWebApp\ParkWebApp.Api\bin\ParkWebApp.Api.dll
My minified css broken since my class used version 2+. I found your code, u get tailwind version "latest" in package.json. so I suspect that error come from the package.json since it will take latest tailwind v3.
We don't have a routine that checks for and installs any updates of the NPM packages.
When using the TailwindCSS build action on two or more files, the build will fail with the above error.
This is because the target files will be concatenated with an ';' and the index.js will not handle that correctly
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.