@imp/rules/asset

Asset rules

Declare workspace source files as graph handles. The asset build captures files without writing build products into the workspace.

Public API

asset({ srcs, base?, path?, exclude? }) returns sources and a BUILD root. resource_package(options) returns sources and the same handle as files for resource dependencies. It has no BUILD root. Paths must stay within the workspace.

Illustrative example

local asset = require("@imp/rules/asset")
return {
    web_assets = asset.asset({ base = "web", srcs = { "**/*.css", "**/*.js" } }),
}

Use the returned handles in task inputs. Declare tools separately. Asset ownership follows the selected source globs and the workspace ignore rules.

asset(options)

Capture a source collection and expose its BUILD workflow.

  • Parameter options — Source globs, base, path, and exclusions. Returns: A table with sources and a BUILD task.

Source: rules/asset/index.luau:51.

resource_package(options)

Capture resource files for use as explicit graph dependencies.

  • Parameter options — Source globs, base, path, and exclusions. Returns: A table with sources and a files handle. It has no BUILD root.

Source: rules/asset/index.luau:75.