trapcodeio / vite-plugin-ejs

Vite: Use Ejs in your entypoints i.e index.html
https://stackblitz.com/edit/vite-plugin-ejs
66 stars 5 forks source link

How to create new param #2

Closed 4spen closed 2 years ago

4spen commented 3 years ago

Hi, need some advice on how to create something like isProd? And how to rename isDev?

trapcodeio commented 3 years ago

isDev was internally defined by the plugin and unfortunately cannot be renamed but you can add isProd or any other param you want like so.

import {defineConfig} from "vite";
import {ViteEjsPlugin} from "vite-plugin-ejs";

export default defineConfig({
  plugins: [
    ViteEjsPlugin((viteConfig) => {
      // viteConfig is the current viteResolved config.
      return {
        isProd: viteConfig.isProduction,
        someOtherParam: "value"
      }
    }),
  ],
});

The viteConfig variable has the options listed in https://vitejs.dev/config/#shared-options

Do let me know if this is what you meant by adding param.

trapcodeio commented 3 years ago

Did this serve? @4spen

If no reply I would close this issue in the next 48 hrs.

4spen commented 2 years ago

This helped me, thank you!

On Sat, Nov 20, 2021 at 12:59 PM TrapCode @.***> wrote:

Did this serve? @4spen https://github.com/4spen

If no reply I would close this issue in the next 48 hrs.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/trapcodeio/vite-plugin-ejs/issues/2#issuecomment-974632249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEB2HAQZ45HXSRGKXY3BK5LUM55RBANCNFSM5HTBTYXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Geros dienos,

Evelina Rimkutė