as is
This commit is contained in:
21
rollup-plugin-robots.ts
Normal file
21
rollup-plugin-robots.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { join } from "path";
|
||||
import { type Plugin } from "rollup";
|
||||
|
||||
export default function robotsPlugin(): Plugin {
|
||||
return {
|
||||
name: "rollup-plugin-robots",
|
||||
writeBundle(options, _) {
|
||||
this.debug(options.dir || "dir undefined");
|
||||
if (options.dir) {
|
||||
this.fs
|
||||
.writeFile(
|
||||
join(options.dir, "robots.txt"),
|
||||
"User-agent: *\nDisallow: /",
|
||||
)
|
||||
.catch((err) => {
|
||||
this.error(err);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user