Skip to content

Instantly share code, notes, and snippets.

@david-mart
Created January 9, 2022 04:02
Show Gist options
  • Save david-mart/2499000d31ab03d08be7a7e3ad376661 to your computer and use it in GitHub Desktop.
Save david-mart/2499000d31ab03d08be7a7e3ad376661 to your computer and use it in GitHub Desktop.
import vue from "rollup-plugin-vue";
import typescript from "rollup-plugin-typescript2";
import commonjs from "rollup-plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import postcss from "rollup-plugin-postcss";
import vueGbsModule from "./prefix.plugin";
import postcssImport from "postcss-import";
import tailwind from "tailwindcss";
import purgecss from "@fullhuman/postcss-purgecss";
import prefixer from "postcss-prefixer";
import replace from "@rollup/plugin-replace";
import { Result } from "postcss";
import prefixCssPlugin from "./prefix-css.plugin";
import { Root } from "postcss";
import cssnano from "cssnano";
const name = "index";
// Output packaged file name type 1.esm 2.umd
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
const file = (type) => `dist/${name}.${type}.js`;
const tsconfigOverride = {
compilerOptions: { declaration: true }, // Generate .d.ts The file of
exclude: ["tests/**/*.ts", "tests/**/*.tsx", "src/**/stories.ts"],
};
const prefix = "gbs-";
export { name, file };
export default {
input: "src/index.ts",
output: {
name,
file: file("esm"),
format: "es",
},
plugins: [
postcss({
plugins: [
tailwind("./tailwind.config.js"),
postcssImport,
cssnano,
// prefixer({
// prefix,
// }),
// prefixCssPlugin(),
// (rule, v) => {
// console.log(rule.toResult().css);
// },
],
// config: "./postcss.config.js",
}),
nodeResolve(),
typescript({ tsconfigOverride }),
commonjs(),
vue({
template: {
// compilerOptions: { modules: [vueGbsModule({ prefix })] },
},
}),
],
external: ["vue", "ramda"],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment