sp-dev-fx-webparts/samples/react-tailwindcss3
dependabot[bot] 7049459b37
Bump follow-redirects in /samples/react-tailwindcss3
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.3 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.3...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-11 03:15:59 +00:00
..
.devcontainer Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
assets Fixed broken preview 2023-11-19 13:56:13 -08:00
config Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
fast-serve Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
src Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
teams Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
.nvmrc Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
README.md Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
gulpfile.js Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
package-lock.json Bump follow-redirects in /samples/react-tailwindcss3 2024-01-11 03:15:59 +00:00
package.json Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
postcss.config.js Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
tailwind.config.js Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00
tsconfig.json Renamed folder, added container, sample.json 2023-10-23 12:24:59 -04:00

README.md

Tailwind 3

Summary

This project showcases an integration of Tailwind CSS into an SPFx project. It offers a sample implementation, facilitating straightforward setup and utilization of Tailwind CSS for enhanced styling and design in SharePoint Framework projects.

Here is an illustration of the styling outcome achieved with Tailwind, along with the corresponding code.

Result Code

To setup Tailwind on your existing project, proceed with the following steps:

  1. Execute the following commands:
    • npm i -D react-tailwindcss postcss autoprefixer gulp-postcss
    • npx react-tailwindcss init
  2. Add the following files:
    • /assets/tailwind.css
    • postcss.config.js
    • tailwind.config.js
  3. Update the following files:
    • gulpfile.js
      • Check the changes in this project
    • entry/main component file (e.g. /src/webparts/HelloTailwind/HelloTailwindWebPart.ts)
      • Add import '../../../assets/dist/tailwind.css

Compatibility

⚠️ Important
Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to build this sample, you need to ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.
Refer to https://aka.ms/spfx-matrix for more information on SPFx compatibility.

This sample is optimally compatible with the following environment configuration:

SPFx 1.18.0 Node.js v18.18 Compatible with SharePoint Online Local Workbench Unsupported Hosted Workbench Compatible Compatible with Remote Containers

Applies to

Get your own free development tenant by subscribing to Microsoft 365 developer program

Contributors

Version history

Version Date Comments
1.0 October 7, 2023 Initial release

Minimal path to awesome

  • Clone this repository (or download this solution as a .ZIP file then unzip it)
  • From your command line, change your current directory to the directory containing this sample (react-tailwindcss3, located under samples)
  • in the command line run:
    • npm install
    • gulp serve

This sample can also be opened with VS Code Remote Development. Visit https://aka.ms/spfx-devcontainer for further instructions.

Help

We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you're having issues building the solution, please run spfx doctor from within the solution folder to diagnose incompatibility issues with your environment.

You can try looking at issues related to this sample to see if anybody else is having the same issues.

You can also try looking at discussions related to this sample and see what the community is saying.

If you encounter any issues using this sample, create a new issue.

For questions regarding this sample, create a new question.

Finally, if you have an idea for improvement, make a suggestion.

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.