Skip to content

Commit f3523f3

Browse files
committed
Added tailwind documentation.
1 parent 18b93e2 commit f3523f3

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

docs/third_party/sapui5.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Integrating Sap UI5 Web Components
2+
3+
Follow the instructions detailed here: https://github.com/NuiCpp/ui5

docs/third_party/tailwindcss.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Tailwind CSS
2+
3+
## Install
4+
5+
In your project root directory, run the following command to add Tailwind CSS to your project:
6+
```bash
7+
npx add-dependencies tailwindcss postcss dotenv
8+
```
9+
10+
## Configure
11+
12+
Create a `tailwind.config.js` file in your project root directory with the following content:
13+
```javascript
14+
require('dotenv').config()
15+
16+
module.exports = {
17+
content: {
18+
files: [
19+
// Adapt this to your needs, this works with a project created from the NUI template.
20+
`${process.env.NUI_PROJECT_ROOT}/frontend/**/*.{cpp,hpp}`,
21+
`${process.env.NUI_PROJECT_ROOT}/static/**/*.{html,js}`
22+
]
23+
},
24+
theme: {
25+
extend: {},
26+
},
27+
plugins: [],
28+
}
29+
```
30+
31+
Create a `.postcssrc` file in your project root directory with the following content:
32+
```json
33+
{
34+
"plugins": {
35+
"tailwindcss": {}
36+
}
37+
}
38+
```
39+
40+
Add the Tailwind directives to your CSS file:
41+
nui-template/static/styles/main.css:
42+
```css
43+
@tailwind base;
44+
@tailwind components;
45+
@tailwind utilities;
46+
```
47+
48+
## Enable in CMake
49+
50+
In your backend CMakeLists.txt in your `nui_add_emscripten_target` call, add the ENABLE_TAILWIND option:
51+
```cmake
52+
nui_add_emscripten_target(
53+
...
54+
ENABLE_TAILWIND
55+
)
56+
```
57+
58+
## Use in Your Application
59+
60+
```cpp
61+
#include <frontend/main_page.hpp>
62+
63+
#include <nui/frontend/elements.hpp>
64+
#include <nui/frontend/attributes.hpp>
65+
66+
Nui::ElementRenderer MainPage::render()
67+
{
68+
using namespace Nui;
69+
using namespace Nui::Elements;
70+
using namespace Nui::Attributes;
71+
using Nui::Elements::div; // because of the global div.
72+
73+
// use of the tailwind classes:
74+
return body{}(h1{class_ = "text-3xl font-bold underline"}("Hello, Tailwind!"));
75+
}
76+
```

sidebars.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ const sidebars = {
148148
collapsible: true,
149149
collapsed: true,
150150
items: [
151+
{
152+
type: 'doc',
153+
id: 'third_party/tailwindcss',
154+
label: 'Tailwind CSS',
155+
},
156+
{
157+
type: 'doc',
158+
id: 'third_party/sapui5',
159+
label: 'UI5 Web Components',
160+
},
151161
{
152162
type: 'doc',
153163
id: 'third_party/bootstrap',

0 commit comments

Comments
 (0)