@visulima/packem
Version:
A fast and modern bundler for Node.js and TypeScript.
47 lines (46 loc) • 1.71 kB
TypeScript
import type { PluginCreator } from "postcss";
import type { UrlResolve } from "./url-resolve.d.ts";
declare const plugin: PluginCreator<UrlOptions>;
/** URL handler options */
export interface UrlOptions {
/**
* Aliases for URL paths.
* Overrides the global `alias` option.
* - ex.: `{"foo":"bar"}`
*/
alias?: Record<string, string>;
/**
* Directory path for outputted CSS assets,
* which is not included into resulting URL
* @default "."
*/
assetDir?: string | ((original: string, resolved: string, file: string) => string);
/**
* Enable/disable name generation with hash for outputted CSS assets
* or provide your own placeholder with the following blocks:
* - `[extname]`: The file extension of the asset including a leading dot, e.g. `.png`.
* - `[ext]`: The file extension without a leading dot, e.g. `png`.
* - `[hash(:<num>)]`: A hash based on the name and content of the asset (with optional length).
* - `[name]`: The file name of the asset excluding any extension.
*
* Forward slashes / can be used to place files in sub-directories.
* @default "assets/[name]-[hash][extname]" ("assets/[name][extname]" if false)
*/
hash?: boolean | string;
/**
* Inline files instead of copying
* @default true for `inject` mode, otherwise false
*/
inline?: boolean;
/**
* Public Path for URLs in CSS files
* @default "./"
*/
publicPath?: string | ((original: string, resolved: string, file: string) => string);
/**
* Provide custom resolver for URLs
* in place of the default one
*/
resolve?: UrlResolve;
}
export = plugin;