def METHOD_NAME(ctx):
    """Compiles HTMLs into one HTML.
    The rule outputs a HTML that resolves all HTML `rel=import` statements into
    one document. The rule also combines content of all script elements to a
    JavaScript file when `js_path` is specified.
    """
    deps = unfurl(ctx.attr.deps, provider = "webfiles")
    manifests = depset(order = "postorder")
    files = depset()
    webpaths = depset()
    for dep in deps:
        manifests = depset(transitive = [manifests, dep.webfiles.manifests])
        webpaths = depset(transitive = [webpaths, dep.webfiles.webpaths])
        files = depset(transitive = [files, dep.data_runfiles.files])
    webpaths = depset([ctx.attr.output_path], transitive = [webpaths])
    closure_js_library = collect_js(
        unfurl(ctx.attr.deps, provider = "closure_js_library"),
    )
    # vulcanize
    ctx.actions.run(
        inputs = depset(transitive = [
            manifests,
            files,
        ]).to_list(),
        outputs = [ctx.outputs.html, ctx.outputs.js],
        executable = ctx.executable._Vulcanize,
        arguments = ([
                         ctx.attr.input_path,
                         ctx.attr.output_path,
                         ctx.attr.js_path,
                         ctx.outputs.html.path,
                         ctx.outputs.js.path,
                     ] +
                     [f.path for f in manifests.to_list()]),
        mnemonic = "Vulcanize",
        progress_message = "Vulcanizing %s" % ctx.attr.input_path,
    )
    # webfiles manifest
    manifest_srcs = [struct(
        path = ctx.outputs.html.path,
        longpath = long_path(ctx, ctx.outputs.html),
        webpath = ctx.attr.output_path,
    )]
    if ctx.attr.js_path:
        manifest_srcs.append(
            struct(
                path = ctx.outputs.js.path,
                longpath = long_path(ctx, ctx.outputs.js),
                webpath = ctx.attr.js_path,
            ),
        )
    manifest = ctx.actions.declare_file("%s.pbtxt" % ctx.label.name)
    ctx.actions.write(
        output = manifest,
        content = struct(
            label = str(ctx.label),
            src = manifest_srcs,
        ).to_proto(),
    )
    manifests = depset([manifest], transitive = [manifests])
    transitive_runfiles = depset()
    for dep in deps:
        transitive_runfiles = depset(transitive = [
            transitive_runfiles,
            dep.data_runfiles.files,
        ])
    return struct(
        files = depset([ctx.outputs.html, ctx.outputs.js]),
        webfiles = struct(
            manifest = manifest,
            manifests = manifests,
            webpaths = webpaths,
            dummy = ctx.outputs.html,
        ),
        runfiles = ctx.runfiles(
            files = ctx.files.data + [
                manifest,
                ctx.outputs.html,
                ctx.outputs.js,
            ],
            transitive_files = transitive_runfiles,
        ),
    )