--- title: 'Assets' navigation: icon: i-ph:folder-notch-open-duotone description: 'Browse, preview, and manage files in a directory, porting Nuxt DevTools'' Assets tab.' --- Browse, preview, and manage files in a directory, porting Nuxt DevTools' Assets tab. Package: `@devframes/plugin-assets` ยท framework: **Vue + @antfu/design** ![Assets devframe screenshot](/screenshots/plugin-assets-1.png) _File browser and details panel_ ## What it does Search by name, filter by type, view as a thumbnail grid or tree, and open a details panel: live preview (image, video, audio, font, text), metadata, and copy-ready snippets (``, `background-image`, `@font-face`). Upload via toolbar or drag-and-drop, multi-select to delete; a watcher keeps listings synced. The standalone server requires devframe's trust handshake; write is on by default (`{ write: false }` / `--read-only` for browse-only). ## Standalone ```sh pnpx @devframes/plugin-assets # manages /public pnpx @devframes/plugin-assets --read-only # disable upload / rename / delete / mkdir ``` ## Mount into a Vite host For a [Vite DevTools](https://devtools.vite.dev) app: ```ts // vite.config.ts import createAssetsDevframe from '@devframes/plugin-assets' import { createPluginFromDevframe } from '@vitejs/devtools-kit/node' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ createPluginFromDevframe(createAssetsDevframe()), ], }) ``` Or use `devframeVite` from `@devframes/vite/single`. ## Programmatic `createAssetsDevframe(options)` returns a definition for any adapter: ```ts import { createAssetsDevframe } from '@devframes/plugin-assets' export default createAssetsDevframe({ dir: 'static', baseURL: '/', write: true, uploadExtensions: ['png', 'jpg', 'svg', 'webp'], // or '*' for any }) ``` | Option | Default | Description | |--------|---------|-------------| | `dir` | `/public` | Directory to manage. | | `baseURL` | `/` | URL base the user app serves `dir` at (e.g. Nuxt `app.baseURL`). | | `write` | `true` | Enable upload, rename, delete, mkdir. | | `uploadExtensions` | Nuxt DevTools' allow-list | Extensions `upload` accepts, or `'*'`. | | `serveStatic` | `false` | Serve the directory's bytes; on for the standalone CLI. | | `build` | `false` | Registers the `build` subcommand ([Static export](#static-export)). | ## How previews are served Previews load by **public URL** (`baseURL` + path). ## RPC Namespaced `devframes:plugin:assets:*`: | Function | Type | Notes | |----------|------|-------| | `list` | `query`, `snapshot: true` | Every file: type, size, mtime. | | `capabilities` | `query`, `snapshot: true` | Write-enabled flag; the allow-list. | | `read-image-meta` | `query` | Width/height/orientation. | | `read-text` | `query` | Truncated preview text; server-highlighted via [`@devframes/service-shiki`](/add-ons/services/shiki), else plain `
`. |
| `upload` | `action` | Streaming upload slot; the SPA pipes bytes. |
| `rename` | `action` | Renames one (keeps extension). |
| `delete` | `action` | Deletes one or more. |
| `mkdir` | `action` | Creates a folder + parents. |
| `open-in-editor` / `reveal-in-folder` | `action` | Open/reveal via [`@devframes/service-open`](/add-ons/services/open); always registered. |

`upload` / `rename` / `delete` / `mkdir` register only with `write`.

## Static export

The `build` subcommand is disabled by default (`capabilities: { build: false }`). Pass `{ build: true }` (or `{ force: true }` to `createBuild()`) to bake the listing.

## Source

[`plugins/assets`](https://github.com/devframes/devframe/tree/main/plugins/assets)