This repository contains an example of how to integrate Tailwind CSS, and DaisyUI into your FusionAuth theme.
- Node.js
- Yarn or NPM
- A FusionAuth instance. This can be locally installed or in the cloud. See FusionAuth for more information.
- (optional) FreeMarker plugin for VSCode: https://marketplace.visualstudio.com/items?itemName=dcortes92.FreeMarker
- Create an API key in FusionAuth. This key will be used to communicate with the FusionAuth API. See API Keys for more information.
- Navigate to Settings > API Keys.
- Click Add.
- Enter a description for the key.
- Select
GET
andPATCH
options for/api/theme
- Note the API key value. This will be used in step 3.
- Click Save.
- Duplicate the default FusionAuth theme
- Navigate to Settings > Themes.
- Click Duplicate.
- Enter a name for the theme.
- Click Save.
- Note the ID of the theme. This will be used in step 3.
- Run
npx fusionauth theme:download <themeId> --k <apiKey>
to export the theme. - The theme will be downloaded to the
tpl
directory.
Please note that the export will overwrite the tpl
directory, and any changes you have made to the files will be lost.
- Run
tailwindcss -i ./input.css -o ./tpl/stylesheet.css
to build the tailwind css. - The css will be built to the
tpl/stylesheet.css
file.
If you want to minify the css, run tailwindcss -i ./input.css -o ./tpl/stylesheet.css --minify
.
- Run
npx fusionauth theme:upload <themeId> --k <apiKey>
to export the theme. - The theme will be uploaded from the
tpl
directory.
Please note that the import will overwrite the theme in FusionAuth, and any changes you have made to the theme through the FusionAuth UI will be lost.
- Add custom styles to the
input.css
file.
Run npm run watch:theme
and npm run watch:tailwind
in two separate terminals to automatically build and upload the theme when changes are made.