{"_id":"@4rk/vite-plugin-twigjs-loader","name":"@4rk/vite-plugin-twigjs-loader","dist-tags":{"latest":"2.0.3"},"versions":{"2.0.3":{"name":"@4rk/vite-plugin-twigjs-loader","version":"2.0.3","description":"A Vite plugin for loading twig files. Similar to the twigjs-loader","main":"index.js","type":"module","keywords":["twig","vite","vite-plugin"],"author":{"name":"Fork Unstable Media GmbH","email":"obj@fork.de"},"repository":{"type":"git","url":"git+https://github.com/fork/vite-plugin-twigjs-loader.git"},"license":"MIT","dependencies":{"twig":"^1.17.1"},"types":"./types.d.ts","_id":"@4rk/vite-plugin-twigjs-loader@2.0.3","gitHead":"330b4171a73198da66f4a1b0e7c962573c0c3112","bugs":{"url":"https://github.com/fork/vite-plugin-twigjs-loader/issues"},"homepage":"https://github.com/fork/vite-plugin-twigjs-loader#readme","_nodeVersion":"18.20.3","_npmVersion":"10.7.0","dist":{"integrity":"sha512-K54JRPzB1pQYo8xbuTQsrHFHVxkI7Vv3fuBXLXl4YEUyP0UFx8/iMXt4DCVUT/yjbd5s5IpQhAjLhEzFxtixqg==","shasum":"5c0e5cc94e17f4cb2870555cba3392158782576d","tarball":"https://registry.npmjs.org/@4rk/vite-plugin-twigjs-loader/-/vite-plugin-twigjs-loader-2.0.3.tgz","fileCount":4,"unpackedSize":10164,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDSm1UF3SAt0Mfti4yhZqYr/SIHs1wUlM7kAfn50pcDYAiEAvRTyS2i049renuwDsQJapV+78Wrt+cJ/MDxY1yRYby0="}]},"_npmUser":{"name":"holmey","email":"mail@holgermeyer.net"},"directories":{},"maintainers":[{"name":"holmey","email":"mail@holgermeyer.net"},{"name":"jonas.leonhard","email":"jonasleonhardfl@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-twigjs-loader_2.0.3_1740494703574_0.39192361992939984"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-25T14:45:03.481Z","2.0.3":"2025-02-25T14:45:03.721Z","modified":"2025-02-25T14:45:03.977Z"},"maintainers":[{"name":"holmey","email":"mail@holgermeyer.net"},{"name":"jonas.leonhard","email":"jonasleonhardfl@gmail.com"}],"description":"A Vite plugin for loading twig files. Similar to the twigjs-loader","homepage":"https://github.com/fork/vite-plugin-twigjs-loader#readme","keywords":["twig","vite","vite-plugin"],"repository":{"type":"git","url":"git+https://github.com/fork/vite-plugin-twigjs-loader.git"},"author":{"name":"Fork Unstable Media GmbH","email":"obj@fork.de"},"bugs":{"url":"https://github.com/fork/vite-plugin-twigjs-loader/issues"},"license":"MIT","readme":"A simple vite loader plugin - https://www.npmjs.com/package/vite-plugin-twigjs-loader\n\n1. Installation\n```bash\nnpm install -D vite-plugin-twigjs-loader\n```\n\n2. Add to your vite config\n\n```javascript\n// vite.config.js\nimport vue from '@vitejs/plugin-vue';\nimport twig from 'vite-plugin-twigjs-loader';\n\nexport default ({ command }) => ({\n  plugins: [\n    vue(),\n    twig({\n      namespaces: { '@projects': __dirname }, // // allows imports like this: '{% from \"@projects/src/helper.html.twig\" import some_helper_function %}'\n      strict_variables: true\n    }),\n  ],\n  resolve: {\n    alias: {\n      '@project': __dirname\n    }\n  }\n});\n```\n\n3. Import twig components. This example shows using the plugin in a storybook story.\n\n```javascript\n// src/components/your-twig-components/YourTwigComponent.stories.js\n// this is a function you can call, that renders to html via twigjs\nimport YourTwigComponent from './YourTwigComponent.twig';\n\nexport default {\n  title: 'Components/YourTwigComponentStoryName',\n};\n\nconst Template = args => ({\n  template: YourTwigComponent({\n    test: 'This string will be usable as \"test\" in your twig component'\n  })\n});\n\nexport const StoryName = Template.bind({});\n```\n","readmeFilename":"README.md"}