Skip to content

Commit 4d3cfdd

Browse files
committed
Tailwind and cache docs
1 parent 93b6d72 commit 4d3cfdd

File tree

4 files changed

+98
-54
lines changed

4 files changed

+98
-54
lines changed

bolt-cache/README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,48 @@
11
<!-- This file is compiled from bolt-cache/bolt/cache/README.md. Do not edit this file directly. -->
22

3-
# bolt-cache
3+
# Cache
44

5-
Caching API with several different backends.
5+
A simple cache using the database.
6+
7+
The Bolt Cache stores JSON-serializable values in a `CachedItem` model.
8+
Cached data can be set to expire after a certain amount of time.
9+
10+
Access to the cache is provided through the `Cached` class.
11+
12+
```python
13+
from bolt.cache import Cached
14+
15+
16+
cached = Cached("my-cache-key")
17+
18+
if cached.exists():
19+
print("Cache hit and not expired!")
20+
print(cached.value)
21+
else:
22+
print("Cache miss!")
23+
cached.set("a JSON-serializable value", expiration=60)
24+
25+
# Delete the item if you need to
26+
cached.delete()
27+
```
28+
29+
Expired cache items can be cleared with `bolt cache clear-expired`.
30+
You can run this on a schedule through various cron-like tools or [bolt-worker](../../../bolt-worker/bolt/worker/).
631

732
## Installation
833

9-
- install pkg
10-
- add to INSTALLED_APPS
34+
Add `bolt.cache` to your `INSTALLED_PACKAGES`:
35+
36+
```python
37+
# app/settings.py
38+
INSTALLED_PACKAGES = [
39+
# ...
40+
"bolt.cache",
41+
]
42+
```
1143

1244
## CLI
45+
46+
- `bolt cache clear-expired` - Clear all expired cache items
47+
- `bolt cache clear-all` - Clear all cache items
48+
- `bolt cache stats` - Show cache statistics

bolt-cache/bolt/cache/README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
1-
# bolt-cache
1+
# Cache
22

3-
Caching API with several different backends.
3+
A simple cache using the database.
4+
5+
The Bolt Cache stores JSON-serializable values in a `CachedItem` model.
6+
Cached data can be set to expire after a certain amount of time.
7+
8+
Access to the cache is provided through the `Cached` class.
9+
10+
```python
11+
from bolt.cache import Cached
12+
13+
14+
cached = Cached("my-cache-key")
15+
16+
if cached.exists():
17+
print("Cache hit and not expired!")
18+
print(cached.value)
19+
else:
20+
print("Cache miss!")
21+
cached.set("a JSON-serializable value", expiration=60)
22+
23+
# Delete the item if you need to
24+
cached.delete()
25+
```
26+
27+
Expired cache items can be cleared with `bolt cache clear-expired`.
28+
You can run this on a schedule through various cron-like tools or [bolt-worker](../../../bolt-worker/bolt/worker/).
429

530
## Installation
631

7-
- install pkg
8-
- add to INSTALLED_APPS
32+
Add `bolt.cache` to your `INSTALLED_PACKAGES`:
33+
34+
```python
35+
# app/settings.py
36+
INSTALLED_PACKAGES = [
37+
# ...
38+
"bolt.cache",
39+
]
40+
```
941

1042
## CLI
43+
44+
- `bolt cache clear-expired` - Clear all expired cache items
45+
- `bolt cache clear-all` - Clear all cache items
46+
- `bolt cache stats` - Show cache statistics

bolt-tailwind/README.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
Integrate Tailwind CSS without JavaScript or npm.
66

7-
Use [Tailwind CSS](https://tailwindcss.com/) with [Django](https://www.djangoproject.com/) *without* requiring JavaScript or npm.
8-
9-
Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli).
7+
Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli),
8+
which is installed for you.
109

1110
```console
1211
$ bolt tailwind
@@ -25,13 +24,7 @@ Commands:
2524

2625
## Installation
2726

28-
First, install `bolt-tailwind` from [PyPI](https://pypi.org/project/bolt-tailwind/):
29-
30-
```sh
31-
pip install bolt-tailwind
32-
```
33-
34-
Then add `bolt.tailwind` to your `INSTALLED_PACKAGES`:
27+
Add `bolt.tailwind` to your `INSTALLED_PACKAGES`:
3528

3629
```python
3730
# settings.py
@@ -74,19 +67,12 @@ You should add `.bolt` to your `.gitignore` file.
7467

7568
## Updating Tailwind
7669

77-
This package manages the Tailwind versioning by comparing `.bolt/tailwind.version` to the `FORGE_TAILWIND_VERSION` variable that is injected into your `tailwind.config.js` file.
78-
79-
```js
80-
const FORGE_TAILWIND_VERSION = "3.0.24"
70+
This package manages the Tailwind versioning by comparing the value in your `pyproject.toml` to `.bolt/tailwind.version`.
8171

82-
module.exports = {
83-
theme: {
84-
extend: {},
85-
},
86-
plugins: [
87-
require("@tailwindcss/forms"),
88-
],
89-
}
72+
```toml
73+
# pyproject.toml
74+
[tool.bolt.tailwind]
75+
version = "3.4.1"
9076
```
9177

9278
When you run `tailwind compile`,
@@ -95,7 +81,7 @@ it will automatically check whether your local installation needs to be updated
9581
You can use the `update` command to update your project to the latest version of Tailwind:
9682

9783
```sh
98-
tailwind update
84+
bolt tailwind update
9985
```
10086

10187
## Adding custom CSS

bolt-tailwind/bolt/tailwind/README.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
Integrate Tailwind CSS without JavaScript or npm.
44

5-
Use [Tailwind CSS](https://tailwindcss.com/) with [Django](https://www.djangoproject.com/) *without* requiring JavaScript or npm.
6-
7-
Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli).
5+
Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli),
6+
which is installed for you.
87

98
```console
109
$ bolt tailwind
@@ -23,13 +22,7 @@ Commands:
2322

2423
## Installation
2524

26-
First, install `bolt-tailwind` from [PyPI](https://pypi.org/project/bolt-tailwind/):
27-
28-
```sh
29-
pip install bolt-tailwind
30-
```
31-
32-
Then add `bolt.tailwind` to your `INSTALLED_PACKAGES`:
25+
Add `bolt.tailwind` to your `INSTALLED_PACKAGES`:
3326

3427
```python
3528
# settings.py
@@ -72,19 +65,12 @@ You should add `.bolt` to your `.gitignore` file.
7265

7366
## Updating Tailwind
7467

75-
This package manages the Tailwind versioning by comparing `.bolt/tailwind.version` to the `FORGE_TAILWIND_VERSION` variable that is injected into your `tailwind.config.js` file.
76-
77-
```js
78-
const FORGE_TAILWIND_VERSION = "3.0.24"
68+
This package manages the Tailwind versioning by comparing the value in your `pyproject.toml` to `.bolt/tailwind.version`.
7969

80-
module.exports = {
81-
theme: {
82-
extend: {},
83-
},
84-
plugins: [
85-
require("@tailwindcss/forms"),
86-
],
87-
}
70+
```toml
71+
# pyproject.toml
72+
[tool.bolt.tailwind]
73+
version = "3.4.1"
8874
```
8975

9076
When you run `tailwind compile`,
@@ -93,7 +79,7 @@ it will automatically check whether your local installation needs to be updated
9379
You can use the `update` command to update your project to the latest version of Tailwind:
9480

9581
```sh
96-
tailwind update
82+
bolt tailwind update
9783
```
9884

9985
## Adding custom CSS

0 commit comments

Comments
 (0)