0.3.1 • Published 10 months ago

@ui-doc/rollup v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

UI-Doc rollup plugin

This plugin integrates UI-Doc into rollup.

Install

# npm
npm install --save-dev @ui-doc/rollup @ui-doc/html-renderer @highlightjs/cdn-assets

# yarn
yarn add --dev @ui-doc/rollup @ui-doc/html-renderer @highlightjs/cdn-assets

# pnpm
pnpm install --save-dev @ui-doc/rollup @ui-doc/html-renderer @highlightjs/cdn-assets

Setup

import uidoc from '@ui-doc/rollup'
import postcss from 'rollup-plugin-postcss'

export default [
  {
    input: {
      app: 'css/index.css',
    },
    output: {
      dir: 'dist',
    },
    plugins: [
      postcss({
        extract: 'app.css',
      }),
      uidoc({
        settings: {
          generate: {
            logo: () => 'Rollup',
          },
          texts: {
            title: 'Rollup Example',
          },
        },
        source: ['css/**/*.css'],
        assets: {
          example: {
            name: 'app',
            input: true,
          },
        },
      }),
    ],
  },
]

Options

NameRequiredTypeDescription
blockParsernoBlockParserGive a custom BlockParser instance to change the block parsing.
renderernoRendererInstance of renderer. Per default a instance of @ui-doc/html-renderer will be created.
sourceyesstring[]List of glob patterns to find source files. Please see picomatch how to define patterns.
outputDirnostringChange output directory to create the UI-Doc in a subfolder of your application.
templatePathnostringWhen using the default renderer you can override default templates from the renderer or add custom templates for generation.
outputnoobjectChange output settings
output.dirnostringpath where you wan't to put the ui-doc. Will be relativ to rollup's output dir
output.baseUrinostringChange the base URI of you UI-Kit useful if you wan't to place the UI-Doc somewhere else then the output folder. If output.dir is given and no output.baseUri the dir will be used. You can give '.' so all URLs will be relative.
settingsnoobjectUI-Doc specific settings.
settings.generatenoobjectUI-Doc core generate setting
settings.textsnoobjectUI-Doc core texts setting
assetsnoobjectChange asset usage
assets.staticnostringive a static assets folder (path relativ to your working directory), files and sub folders will be copied to the UI-Doc output dir.
assets.styleAssetnofalse / stringWith false prevent including the UI-Doc style. With string change the included style name.
assets.highlightStylenofalse / stringWith false prevent including highlight.js style. With string change name of included style.
assets.highlightThemenostringChange highlight.js style theme (default is default). Please look into the highlight.js repository to see available themes.
assets.highlightScriptnofalse / stringWith false prevent including highlight.js. With string change name of included script.
assets.pagenoAssetOption[]Include custom scripts and styles for UI-Doc pages
assets.examplenoAssetOption[]Include custom scripts and styles for UI-Doc examples
export interface AssetOption {
  name: string | (() => string) // name or relative file name of the asset
  fromInput?: boolean | ((asset: AssetResolved) => boolean) // try to get asset information from rollup's input option. Eg. if you configure the input as object you can give the asset key as name and UI-Doc will try to resolve the asset file for you
  file?: string | (() => string) // load asset from file
  dependency?: string | (() => string) // load the asset from dependency
  source?: string | Uint8Array | (() => string) // give the asset source directly
  attrs?: Record<string, string> // give asset html attributes that should be rendered into the output
}

Upcoming Features

Known Issues

  • When creating assets over rollup input exclusive for UI-Doc the asset will be generated first to roleup's output directory and then be copied to the UI-Doc output.
0.3.1

10 months ago

0.3.0

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.1

12 months ago

0.1.0

12 months ago