{"_id":"@by-association-only/vite-plugin-shopify-modules","_rev":"2-060f345fb78a3f84484814b09cdb6965","name":"@by-association-only/vite-plugin-shopify-modules","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@by-association-only/vite-plugin-shopify-modules","version":"1.0.0","keywords":["vite","shopify","vite-plugin"],"author":{"name":"BAO Agency"},"license":"MIT","_id":"@by-association-only/vite-plugin-shopify-modules@1.0.0","maintainers":[{"name":"dangamble","email":"dan@bao.agency"}],"dist":{"shasum":"ff1940e66e85bafe55b3053c6ac34ecd2349d512","tarball":"https://registry.npmjs.org/@by-association-only/vite-plugin-shopify-modules/-/vite-plugin-shopify-modules-1.0.0.tgz","fileCount":5,"integrity":"sha512-gEaFj5quOB6RP0vLIataGb4CsonhsphZh0niSyMdV9SeYH2YfrUw0Xp7TkcEf7yF/I4sAP8jnQDy4SaEAH9S0Q==","signatures":[{"sig":"MEUCIQC//rO3i9Ez6RQvTRJ/7akt+iz9+B1TeNBsjv6PBiwIcQIgEB5BRMfZi3KlsCwCObegcvMLh2/SC/1k5D52Iuxx61A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16064,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtXNaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpxDA//bu+FPe2i/EW3DvSpl5QzGWKve2cENC1XbhZaDq+dnQu8BJ9x\r\nKmQS1b1Gl6wcwhBaDStJCrpT7EXT7wPx4f1j2AQaywg+eK1gVKXmedQuKohH\r\nz8KqZqsfybZp8rWf0aRkIhah8wnEGUwWmS3LER8cVAUgxmcNO8eVMRPHdMjm\r\nHSnfODnotYvmyGALxFG4/Bkhu/2xdaxug23cbbyPtNS6+mBOUYrfo7y/6QqS\r\nDaRSomV3t2SxP1I8VgqgWCcC6E5qhwDV9bjAylChaILj3gF27TFyjEJ7zJaf\r\nc5xtj/qx0wurnWE0d1Q2wRNxR+MrmDBy37v/cHBjx3UlXjRwxAWi62WYsvjC\r\nZge9CSsOX9dYosWCP081P21MDb9zniMRpV6lpEI4MsOULChSa6iiO0Yw0eTS\r\nM6nkwyBtaKvZ2eB+R2m+b+Z2Dd0D5ohjYVVzDMv/ZFtjCB1/XpEtWGOPDfHH\r\nBMbYY4YKTruwOwmBvgVPhVn/2CIB2tabKXtOuxuXANp7nVl7OyW7mAfZOpdF\r\nV41/jzosGqE4Wh4kVuAcWDwjpc0ExvyDt4jLkhJOglvn1ptvCFLdBqNt5Itt\r\ndxDSgZyIFDNDJxEVIkL5y3Bzyy5+7REFu9WxjZjCdUv7oSPfazesSPy3ssKI\r\niKFZbAOzXzsTD+mSIV8Vive32biwOH11nmU=\r\n=VbYC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","_from":"file:by-association-only-vite-plugin-shopify-modules-1.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"private":false,"scripts":{"dev":"npm run build -- --watch","lint":"eslint .","build":"tsup src/index.ts --dts --format cjs,esm","watch":"tsup src/index.ts --dts --format cjs,esm --watch"},"_npmUser":{"name":"dangamble","email":"dan@bao.agency"},"_resolved":"/private/var/folders/dp/68hsqqtx65z5sztt5bmcr4vr0000gn/T/f2edefcf54e509732a8043c2125bffa1/by-association-only-vite-plugin-shopify-modules-1.0.0.tgz","_integrity":"sha512-gEaFj5quOB6RP0vLIataGb4CsonhsphZh0niSyMdV9SeYH2YfrUw0Xp7TkcEf7yF/I4sAP8jnQDy4SaEAH9S0Q==","_npmVersion":"9.2.0","description":"Vite plugin for organizing Shopify theme code into modules","directories":{},"_nodeVersion":"19.3.0","dependencies":{"lodash":"^4.17.21","chokidar":"^3.5.3","fast-glob":"^3.2.11"},"_hasShrinkwrap":false,"devDependencies":{"tsconfig":"0.0.0"},"peerDependencies":{"vite":"^4.0.4"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-shopify-modules_1.0.0_1672835930186_0.3360691080230951","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@by-association-only/vite-plugin-shopify-modules","version":"1.1.0","keywords":["vite","shopify","vite-plugin"],"author":{"name":"BAO Agency"},"license":"MIT","_id":"@by-association-only/vite-plugin-shopify-modules@1.1.0","maintainers":[{"name":"dangamble","email":"dan@bao.agency"}],"dist":{"shasum":"f3dbf285dbcc27c0dc301517380b6bd4b8270a0c","tarball":"https://registry.npmjs.org/@by-association-only/vite-plugin-shopify-modules/-/vite-plugin-shopify-modules-1.1.0.tgz","fileCount":5,"integrity":"sha512-3L2PT9LTpfxxQxe7ycHWNlze5Bd2Jn/NGLpAnumh4a8sjqoYIBE7nLZWJDNtrPuCZT4guoBOa4uF/ThcXxERIg==","signatures":[{"sig":"MEYCIQCofxwe0e0mhj8d9dvFjKDZigU/86sMXKv/+II/CgqYLQIhAPgRalVOVjS5FDNP9roDYEewIphNxpOWA5S0FHQKO9z1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16168,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvrrQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoo9Q//f+TEYWuH8BU99f41HXEzkjM/MpO9kRkh6H3Xgdapd4hJc5lG\r\ndgjDLNZ0JW0tNabZz5RILOogu3v9xL/ykQYZHphdFO1vRUnc0hqF/opkKpS8\r\nvfr6lOaVJrbEZY9fMQfUQjVlEkMS4WbLrFwtf1XOHBENf8ZWTQxD45Vo/7RI\r\n9Cfhxf8T1riRdxPVRfFiu7RI795SNoRlU+lAAkSUc4o6T8J7TCXT9AypwNxi\r\n0jyzpx7b0yIj4+TMX1oWaK5ya7JqU4SV1l1TyQgXec82WM23AwEPPsvU9gTL\r\n+mVpdyJiBbPtQAi4Q2r8sZMCLPNxEl94NSGdei7lv3IqWZfvvfhGW93lN7m+\r\nMhFVjVci47Tb3JPx6nqIGZ+cyo1y9NPL/ghuMbqjKtevcdYWWD78apPVJxOi\r\nYbjwhG/57qgJk7Kl451qzVGdAq7vPXFbTmkfIXu+Gf+nXxcoGZLL7Md4rlml\r\nm5C+SK/YT6t6Nu+wDshxkSyAb89LQEJZ0SgmfyAzTsZOCTh2rL7qMmifg2Wh\r\nCrTs3ty2e5ZjPswbLxT0wzr9ybeUiDU+a1O3ErijEab4RLZ+0/lYJmTL5INS\r\nuPL/ZwHEXcck7JAHQ8PSurMlHS/AbODGaZo7SHCJ0WNDzeCWXsh069Ao1Omh\r\nOtMzrP9H+4w3BjKFOEY3mqBHqBzl4yrysf4=\r\n=4UuL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","_from":"file:by-association-only-vite-plugin-shopify-modules-1.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"private":false,"scripts":{"dev":"npm run build -- --watch","lint":"eslint **/*.{t,j}s --fix","build":"tsup src/index.ts --dts --format cjs,esm","watch":"tsup src/index.ts --dts --format cjs,esm --watch"},"_npmUser":{"name":"dangamble","email":"dan@bao.agency"},"_resolved":"/private/var/folders/dp/68hsqqtx65z5sztt5bmcr4vr0000gn/T/128b620657a39a19431201e9f1c1142d/by-association-only-vite-plugin-shopify-modules-1.1.0.tgz","_integrity":"sha512-3L2PT9LTpfxxQxe7ycHWNlze5Bd2Jn/NGLpAnumh4a8sjqoYIBE7nLZWJDNtrPuCZT4guoBOa4uF/ThcXxERIg==","_npmVersion":"9.2.0","description":"Vite plugin for organizing Shopify theme code into modules","directories":{},"_nodeVersion":"19.3.0","dependencies":{"lodash":"^4.17.21","chokidar":"^3.5.3","fast-glob":"^3.2.11"},"_hasShrinkwrap":false,"devDependencies":{"tsconfig":"0.0.0"},"peerDependencies":{"vite":"^4.0.4"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-shopify-modules_1.1.0_1673444048361_0.5099025186203259","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-01-04T12:38:50.097Z","modified":"2025-02-19T09:06:16.444Z","1.0.0":"2023-01-04T12:38:50.361Z","1.1.0":"2023-01-11T13:34:08.556Z"},"author":{"name":"BAO Agency"},"license":"MIT","keywords":["vite","shopify","vite-plugin"],"description":"Vite plugin for organizing Shopify theme code into modules","maintainers":[{"email":"dan@bao.agency","name":"dangamble"},{"email":"m.p.england@gmail.com","name":"eng9911"}],"readme":"# vite-plugin-shopify-modules\n\nThis plugin enables Shopify theme developers to structure their code into \"module\" folders which keep Liquid template files (snippets and sections) organized together with their corresponding JS or CSS, while retaining the standard file structure of Shopify themes.\n\n## Features\n\n- Automatically associates each module folder with the matching snippet or section files based on file name\n- Generates symbolic links to corresponding liquid files from module folders\n- Moves liquid files created within module folders to correct theme folders and replaces them with symlinks\n- Fully compatible with Shopify GitHub integration and Shopify CLI features for syncing updates from remote theme\n\n## Install\n\n```bash\nnpm i vite-plugin-shopify-modules -D\n\n# yarn\nyarn add vite-plugin-shopify-modules -D\n\n# pnp\npnpm add vite-plugin-shopify-modules -D\n\n```\n\n## Usage\n\nAdd `shopifyModules` plugin to vite.config.js / vite.config.ts:\n\n```ts\n// vite.config.js / vite.config.ts\nimport shopifyModules from \"vite-plugin-shopify-modules\";\n\nexport default {\n  plugins: [\n    shopifyModules({\n      // Default options shown:\n      modulesDir: \"modules\"\n    })\n  ]\n};\n```\n\n- Create a \"modules\" folder alongside your theme folders, or use the `modulesDir` plugin option to specify an alternate location.\n- Create a subfolder for each theme module. The folder name should precisely match the filename of the corresponding liquid section and/or snippet file.\n- If a section or snippet file exists matching the module folder name, a symlink will be generated pointing from the module folder to the actual file.\n- If a file matching the `[module-name].section.liquid` or `[module-name].snippet.liquid` naming convention is found in the module folder, it will be moved to the corresponding theme folder and replaced with a symlink.\n- You can place any other files in the module folder and they will not be affected by the plugin. If you add JS or CSS, make sure these files are imported from an entrypoint file somewhere to include them in the bundled output.\n\n```bash\nmy-theme\n  ├── assets\n  │── config\n  │── layout\n  │── locales\n  │── modules\n  │   └── cart-drawer\n  │       └── cart-drawer.js\n  │       └── cart-drawer.css\n  │       └── cart-drawer.section.liquid # Symlink to /sections/cart-drawer.liquid\n  │       └── cart-drawer.snippet.liquid # Symlink to /snippets/cart-drawer.liquid\n  │── sections\n  │   └── cart-drawer.liquid\n  │── snippets\n  │   └── cart-drawer.liquid\n  └── templates\n```\n\n## Using module scripts\n\nAdding a script file to a module folder will not have any effect until the file is imported and loaded into your theme.\n\nThis plugin generates an alias to simplify the syntax when importing files from other directories.\n\n- `@modules` or `~modules` will be resolved to the configured modules path.\n- Additionally, you may omit the JS filename to import module scripts using a shorthand syntax.\n\nGiven the default file structure shown above, the following imports are equivalent:\n\n```\n// frontend/entrypoints/main.js\nimport \"../../modules/cart-drawer/cart-drawer.js\"\nimport \"@modules/cart-drawer/cart-drawer.js\"\nimport \"@modules/cart-drawer\"\n```\n\nWhen used in combination with the `additionalEntrypoints` option from vite-plugin-shopify, you also have the option to treat each module script as its own entry point to be loaded directly onto a page using a script tag. For example:\n\n```\n// vite.config.js / vite.config.ts\nimport shopify from \"vite-plugin-shopify\";\nimport shopifyModules from \"vite-plugin-shopify-modules\";\n\nexport default {\n  plugins: [\n    shopify({\n      additionalEntrypoints: ['modules/**/*.js']\n    }),\n    shopifyModules()\n  ]\n}\n```\n\n```\n// modules/cart-drawer/cart-drawer.section.liquid\n{% render 'vite-tag' with '@modules/cart-drawer' %}\n```\n\nSee the [vite-plugin-shopify docs](https://github.com/barrel/barrel-shopify/tree/main/packages/vite-plugin-shopify) for more details on the plugin configuration and `vite-tag` snippet usage.\n\n## Example\n\nSee [seed-theme](https://github.com/barrel/barrel-shopify/tree/main/themes/seed-theme) for an example Shopify theme using this plugin.\n\n## To-Do\n\n- [ ] Unit tests\n\n## Bugs\n\nPlease create an issue if you found any bugs, to help us improve this project!\n","readmeFilename":"README.md"}