Rollup-plugin-prismjs

Github CI Coverage Status

This is another bundler plugin to use PrismJS 1.x in a node project. It's almost a port of babel-plugin-prismjs with most of its test cases, but doesn't use babel any more. (PS: There's vite-plugin-prismjs which is basically a wrapper of babel-plugin-prismjs.)

Installation

npm i rollup-plugin-prismjs -D

Usage

Rollup:

import { rollup } from "rollup";
import { BundlePrismjs } from "rollup-plugin-prismjs";

rollup({
    entry: "main.js",
    plugins: [
        BundlePrismjs({
            languages: [ "markup" ],
        });
    ]
});

Vite:

// vite.config.mjs
import { defineConfig } from "vite";
import { BundlePrismjs } from "rollup-plugin-prismjs";

export default defineConfig({
    plugins: [
        BundlePrismjs({
        }),
    ],
});

License

MIT