{"id":15043233,"url":"https://github.com/hiimjulien/in-vite","last_synced_at":"2026-02-28T15:02:13.786Z","repository":{"id":257396045,"uuid":"858110920","full_name":"HiImJulien/in-vite","owner":"HiImJulien","description":"Vite integration for your Rust :crab: backend.","archived":false,"fork":false,"pushed_at":"2024-11-24T18:49:08.000Z","size":81,"stargazers_count":18,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T09:01:49.725Z","etag":null,"topics":["bundle","bundler","bundling","rust","rust-crate","rust-library","vite"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HiImJulien.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"jkirsch"}},"created_at":"2024-09-16T10:27:10.000Z","updated_at":"2025-02-14T12:05:02.000Z","dependencies_parsed_at":"2024-09-25T01:47:43.569Z","dependency_job_id":"dd93c698-f825-4a46-b66c-b344215405b4","html_url":"https://github.com/HiImJulien/in-vite","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":0.05882352941176472,"last_synced_commit":"541367dbc12d9869580d18741f1523f8ca2f3a32"},"previous_names":["hiimjulien/in-vite"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiImJulien%2Fin-vite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiImJulien%2Fin-vite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiImJulien%2Fin-vite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiImJulien%2Fin-vite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HiImJulien","download_url":"https://codeload.github.com/HiImJulien/in-vite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248955494,"owners_count":21189134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","bundler","bundling","rust","rust-crate","rust-library","vite"],"created_at":"2024-09-24T20:48:44.187Z","updated_at":"2026-02-28T15:02:13.713Z","avatar_url":"https://github.com/HiImJulien.png","language":"Rust","funding_links":["https://ko-fi.com/jkirsch"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eWelcome to in-vite :crab:\u003c/h1\u003e\n\u003c/div\u003e\n\n## What's in-vite?\n\n`In-vite` is a small library, inspired by Laravel's Vite Plugin. It allows you\nto integrate vite's bundling capabilities into your Rust :crab: backend.\n\n## Getting Started :rocket:\n\n```sh\ncargo install in-vite\n```\n\nThe library revolves around the struct `Vite` which handles most aspects and\nis required for integration:\n\n```rs\n\nuse in_vite::Vite;\n\nfn main() {\n  let vite = Vite::default();\n\n  // Retrieve the HTML required to include app.js and it's dependencies.\n  let code = vite.make_html(vec![\"app.js\"]).unwrap();\n}\n\n```\n\n\u003e [!IMPORTANT]\n\u003e `in-vite` does not setup Vite by itself, rather it expects an already\n\u003e setup instance.\n\u003e On how to setup Vite read further.\n\n### Setting up Vite :construction:\n\nThis library requires an instance of Vite to be already setup. To setup Vite\nuse your favorite package manager, for example using `npm`:\n\n```sh\nnpm create vite@latest\n```\n\nNext, you need to extend Vite's `vite.config.js`:\n\n```js\n// vite.config.js\n\nexport default defineConfig({\n  build: {\n    manifest: true,\n    rollupOptions: {\n      input: 'app.js'\n    },\n  }\n});\n\n```\n\nThe manifest is used in production builds to resolve the appropriate\nbuild artifact.\n\n\u003e [!NOTE]\n\u003e You must manually specify entrypoints, since Vite has no `index.html`\n\u003e to go from.\n\n### Further configurations\n\nBy default, Vite serves assets on `http://localhost:5173`. This and other\ndefaults can be overwritten by constructing an instance of `Vite` with\n`ViteOptions`.\n\nLet's suppose, you're running Vite on port `8090`, you can construct an instance\nlike this:\n\n```rs\n\nlet opts = ViteOptions::default().host(\"http://localhost:8090\");\n\nlet vite = Vite::with_options(opts);\n```\n\n### Mode Configuration\n\nBy default `in-vite` is assuming that you're running in development mode,\nunless any of the following environemt variables are set to `production`:\n\n```sh\nLOCO_ENV=production\n# or\nRAILS_ENV=production\n# or\nNODE_ENV=production\n```\n\nThis behavior can be explicitly overwritten using `ViteOptions`:\n\n```rs\nlet opts = ViteOptions::default().mode(ViteMode::Production);\nlet vite = Vite::with_options(opts);\n```\n\n\n## Integrations :world_map:\n\n`in-vite` provides integrations for templating engines such as\n[tera](https://github.com/Keats/tera) and\n[minijinja](https://github.com/mitsuhiko/minijinja). Which can be activated\nusing the appropriate feature flag.\n\n### Integration with `tera`\n\nUsing the feature flag `tera`, the integration can be activated:\n\n```sh\ncargo add in-vite -F tera\n```\n\nIntegrating Vite is as simple as registering a function with your `tera::Tera`\ninstance:\n\n```rs\n\nlet vite = Vite::default();\n\nlet mut tera = tera::Tera::default();\ntera.register_function(\"vite\", vite);\n\nlet template = tera.render_str(r#\"{{ vite(resources=\"app.js\") }}\"#, \u0026tera::Context::new())?;\n\n```\n\n### Integration with `minijinja` :ninja:\n\nLike other integrations, this one can be activated with the feature flag `minijinja`:\n\n```sh\ncargo add in-vite -F minijinja\n```\n\n```rs\nlet vite = Vite::default();\n\nlet mut env = minijinja::Environment::new();\nenv.add_global(\"vite\", minijinja::Value::from_object(vite));\n\nlet template = env.render_str(r#\"{{ vite(resources=\"app.js\") }}\"#, minijinja::Value::UNDEFINED)?;\n```\n\n## Contributing\n\nIf you consider contributing, then first of all: Thank you! :gift_heart:\nThe first and simplest way to show your support is to star this repo.\n\nThis project accepts bug reports and feature requests via the integrated\n[issue tracker](https://github.com/HiImJulien/in-vite/issues). Pull requests\nfor new integrations are also welcome!\n\nAdditionally, code reviews and pointers on how to improve the libraries code\nare welcome. This is my first Rust library after all.\n\n## Sponsoring\n\nThank you for considering sponsoring! While this project does not require\nsponsoring, small donations are accepted. 100% of the donations are used to\nprovide a student (me) :man_student: with a steady supply of caffeinated beverages\nwhich are then metabolized into 100% organic Rust code.\n\n## License\n\nThis project is licensed under the MIT license, which you find\n[here](https://github.com/HiImJulien/in-vite/blob/master/LICENSE.md).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiimjulien%2Fin-vite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiimjulien%2Fin-vite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiimjulien%2Fin-vite/lists"}