Skip to content

Commit

Permalink
Tailwind and cache docs
Browse files Browse the repository at this point in the history
  • Loading branch information
davegaeddert committed Jun 23, 2024
1 parent 93b6d72 commit 4d3cfdd
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 54 deletions.
44 changes: 40 additions & 4 deletions bolt-cache/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,48 @@
<!-- This file is compiled from bolt-cache/bolt/cache/README.md. Do not edit this file directly. -->

# bolt-cache
# Cache

Caching API with several different backends.
A simple cache using the database.

The Bolt Cache stores JSON-serializable values in a `CachedItem` model.
Cached data can be set to expire after a certain amount of time.

Access to the cache is provided through the `Cached` class.

```python
from bolt.cache import Cached


cached = Cached("my-cache-key")

if cached.exists():
print("Cache hit and not expired!")
print(cached.value)
else:
print("Cache miss!")
cached.set("a JSON-serializable value", expiration=60)

# Delete the item if you need to
cached.delete()
```

Expired cache items can be cleared with `bolt cache clear-expired`.
You can run this on a schedule through various cron-like tools or [bolt-worker](../../../bolt-worker/bolt/worker/).

## Installation

- install pkg
- add to INSTALLED_APPS
Add `bolt.cache` to your `INSTALLED_PACKAGES`:

```python
# app/settings.py
INSTALLED_PACKAGES = [
# ...
"bolt.cache",
]
```

## CLI

- `bolt cache clear-expired` - Clear all expired cache items
- `bolt cache clear-all` - Clear all cache items
- `bolt cache stats` - Show cache statistics
44 changes: 40 additions & 4 deletions bolt-cache/bolt/cache/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
# bolt-cache
# Cache

Caching API with several different backends.
A simple cache using the database.

The Bolt Cache stores JSON-serializable values in a `CachedItem` model.
Cached data can be set to expire after a certain amount of time.

Access to the cache is provided through the `Cached` class.

```python
from bolt.cache import Cached


cached = Cached("my-cache-key")

if cached.exists():
print("Cache hit and not expired!")
print(cached.value)
else:
print("Cache miss!")
cached.set("a JSON-serializable value", expiration=60)

# Delete the item if you need to
cached.delete()
```

Expired cache items can be cleared with `bolt cache clear-expired`.
You can run this on a schedule through various cron-like tools or [bolt-worker](../../../bolt-worker/bolt/worker/).

## Installation

- install pkg
- add to INSTALLED_APPS
Add `bolt.cache` to your `INSTALLED_PACKAGES`:

```python
# app/settings.py
INSTALLED_PACKAGES = [
# ...
"bolt.cache",
]
```

## CLI

- `bolt cache clear-expired` - Clear all expired cache items
- `bolt cache clear-all` - Clear all cache items
- `bolt cache stats` - Show cache statistics
32 changes: 9 additions & 23 deletions bolt-tailwind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

Integrate Tailwind CSS without JavaScript or npm.

Use [Tailwind CSS](https://tailwindcss.com/) with [Django](https://www.djangoproject.com/) *without* requiring JavaScript or npm.

Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli).
Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli),
which is installed for you.

```console
$ bolt tailwind
Expand All @@ -25,13 +24,7 @@ Commands:

## Installation

First, install `bolt-tailwind` from [PyPI](https://pypi.org/project/bolt-tailwind/):

```sh
pip install bolt-tailwind
```

Then add `bolt.tailwind` to your `INSTALLED_PACKAGES`:
Add `bolt.tailwind` to your `INSTALLED_PACKAGES`:

```python
# settings.py
Expand Down Expand Up @@ -74,19 +67,12 @@ You should add `.bolt` to your `.gitignore` file.

## Updating Tailwind

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.

```js
const FORGE_TAILWIND_VERSION = "3.0.24"
This package manages the Tailwind versioning by comparing the value in your `pyproject.toml` to `.bolt/tailwind.version`.

module.exports = {
theme: {
extend: {},
},
plugins: [
require("@tailwindcss/forms"),
],
}
```toml
# pyproject.toml
[tool.bolt.tailwind]
version = "3.4.1"
```

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

```sh
tailwind update
bolt tailwind update
```

## Adding custom CSS
Expand Down
32 changes: 9 additions & 23 deletions bolt-tailwind/bolt/tailwind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

Integrate Tailwind CSS without JavaScript or npm.

Use [Tailwind CSS](https://tailwindcss.com/) with [Django](https://www.djangoproject.com/) *without* requiring JavaScript or npm.

Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli).
Made possible by the [Tailwind standalone CLI](https://tailwindcss.com/blog/standalone-cli),
which is installed for you.

```console
$ bolt tailwind
Expand All @@ -23,13 +22,7 @@ Commands:

## Installation

First, install `bolt-tailwind` from [PyPI](https://pypi.org/project/bolt-tailwind/):

```sh
pip install bolt-tailwind
```

Then add `bolt.tailwind` to your `INSTALLED_PACKAGES`:
Add `bolt.tailwind` to your `INSTALLED_PACKAGES`:

```python
# settings.py
Expand Down Expand Up @@ -72,19 +65,12 @@ You should add `.bolt` to your `.gitignore` file.

## Updating Tailwind

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.

```js
const FORGE_TAILWIND_VERSION = "3.0.24"
This package manages the Tailwind versioning by comparing the value in your `pyproject.toml` to `.bolt/tailwind.version`.

module.exports = {
theme: {
extend: {},
},
plugins: [
require("@tailwindcss/forms"),
],
}
```toml
# pyproject.toml
[tool.bolt.tailwind]
version = "3.4.1"
```

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

```sh
tailwind update
bolt tailwind update
```

## Adding custom CSS
Expand Down

0 comments on commit 4d3cfdd

Please sign in to comment.