{"_id":"@atomic.nz/vite-plugin-css-injected-by-js","name":"@atomic.nz/vite-plugin-css-injected-by-js","dist-tags":{"latest":"2.1.1"},"versions":{"2.1.1":{"name":"@atomic.nz/vite-plugin-css-injected-by-js","version":"2.1.1","description":"A Vite plugin that takes the CSS and adds it to the page through the JS. For those who want a single JS file.","main":"dist/cjs/index.js","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"typings":"dist/esm/declarations/index.d.ts","scripts":{"build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && cjs-esm-fixup.sh","format":"prettier 'src/*.ts' --write"},"repository":{"type":"git","url":"git+https://github.com/Marco-Prontera/vite-plugin-css-injected-by-js.git"},"keywords":["vite","vite-plugin","plugin","typescript","css-injected-by-js","single-js-file","css","js"],"peerDependencies":{"vite":">2.0.0-0"},"devDependencies":{"@types/node":"^16.0.0","prettier":"^2.3.2","rimraf":"^3.0.2","typescript":"^4.3.5","vite":"latest"},"author":{"name":"Marco Prontera"},"license":"MIT","bugs":{"url":"https://github.com/Marco-Prontera/vite-plugin-css-injected-by-js/issues"},"homepage":"https://github.com/Marco-Prontera/vite-plugin-css-injected-by-js#readme","gitHead":"807a548ce24a61fe58b9d9d1c0929e7b6d40cbbc","_id":"@atomic.nz/vite-plugin-css-injected-by-js@2.1.1","_nodeVersion":"16.13.1","_npmVersion":"8.5.0","dist":{"integrity":"sha512-gEo4Q4a956LUnsVpLeosJFeLRUnjpu/J5Vcz+oVbHiBgs2U6Fn9kxrXCUQ/x+aVEwA3I2iAkUqyLQee1vZxhig==","shasum":"ac8ac5e116ba3f7acbf4605c8049a579ed3160b4","tarball":"https://registry.npmjs.org/@atomic.nz/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-2.1.1.tgz","fileCount":13,"unpackedSize":17065,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDoQeUAGNzdhc/2Lq8p5Y+B8dQrFzAadaq1s20YrM8W2AIhAPPBDmveG0gLVkn/F6YeRI+HtpDDx8srfXHHjFjvbx+o"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMoQ7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVKg/+OUQlTPNdbDp6DzTHlPtmWHwn8R784BMPA+OrCS6g7FMl18Gr\r\nqRqPfYL/Q5yb2hC/ocYjBakcft9L9ODN13HdLdzFjnW6xT1YLVyvW08Hy6nm\r\ng2q/pXXuNx2ufbrsbBcPv2sX6IS3ReuVrzDkHQng/wAotp/Wq/qO444guCWf\r\n/22SrtQSmCttT0gfOOogtk1UxargIAtWec16o97JZNWjNjZX/QNV6g/0qmsC\r\nlPlzR52I3CunDUJp+6O6yuboiK7NjcUZ6D/nSSbxlFiNPHzl3Cfhn6GZMyH+\r\nu4VIbXCjK7xBmWuqzHtErn+jkkX0PExnhYVt8e1ucNg1qIJAEToaqlVR2lUl\r\nr9dGNtiTvftKUXuY7UxjWBzHUk8+iF51pyQ7zzjQeZaNjkn6TWxJw9Ky8G/C\r\n8O2NcTPXQmbABU+M+mKTsJU4MgzbbCREqV+UQRe6UYprLBbVyLN7i6Brr0yr\r\nRy6bqHPRbCKywnGABGFmvGjHALwS5zM8HiKibQl9CH5efCK+zfYUnRNngpRw\r\nK6wlXUeGsJOEEt3chm9mD1DPsGs3gGWD89UwlXRAIMQHSTxC6KR5gj1gKu2Z\r\nxyF+ZdjQtOFDTPuoidcjtXlHCCsufwR9KU8+4p38oY31Wxo0Dtn8z9rRulDh\r\nZCTvReM408KB8Xzvu3L05ixOv7qjtOAh8e4=\r\n=nypV\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"atomic.nz","email":"npm@atomic.nz"},"directories":{},"maintainers":[{"name":"atomic.nz","email":"npm@atomic.nz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-css-injected-by-js_2.1.1_1664255034942_0.8034076163836366"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-27T05:03:54.899Z","2.1.1":"2022-09-27T05:03:55.158Z","modified":"2022-09-27T05:03:55.282Z"},"maintainers":[{"name":"atomic.nz","email":"npm@atomic.nz"}],"description":"A Vite plugin that takes the CSS and adds it to the page through the JS. For those who want a single JS file.","homepage":"https://github.com/Marco-Prontera/vite-plugin-css-injected-by-js#readme","keywords":["vite","vite-plugin","plugin","typescript","css-injected-by-js","single-js-file","css","js"],"repository":{"type":"git","url":"git+https://github.com/Marco-Prontera/vite-plugin-css-injected-by-js.git"},"author":{"name":"Marco Prontera"},"bugs":{"url":"https://github.com/Marco-Prontera/vite-plugin-css-injected-by-js/issues"},"license":"MIT","readme":"# Vite Plugin: CssInjectedByJs\r\nA Vite plugin that takes the CSS and adds it to the page through the JS. For those who want a single JS file.\r\n\r\n## How does it work\r\nEssentially what it does is take all the CSS generated by the build process and add it via JavaScript.\r\nThe CSS file is therefore not generated and the declaration in the generated HTML file is also removed.\r\nYou can also configure when the CSS injection will be executed (before or after your app code).\r\n\r\n## Installation\r\n```\r\nnpm i vite-plugin-css-injected-by-js --save\r\n```\r\n\r\n## Usage\r\n```ts\r\nimport cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'\r\n\r\nexport default {\r\n  plugins: [\r\n    cssInjectedByJsPlugin(),\r\n  ]\r\n}\r\n```\r\n### Configurations\r\nWhen you add the plugin, you can provide a configuration object.\r\nFor now, you can configure only when the injection of CSS is done at execution time ```topExecutionPriority```.\r\n#### topExecutionPriority\r\nThe default behavior adds the injection of CSS before your bundle code.\r\nIf you provide ```topExecutionPriority``` equal to: ```false```  the code of injection will be added after the bundle code.\r\nThis is an example:\r\n```ts\r\nimport cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'\r\n\r\nexport default {\r\n  plugins: [\r\n    cssInjectedByJsPlugin({topExecutionPriority: false}),\r\n  ]\r\n}\r\n```\r\n\r\n#### styleId\r\nIf you provide a `string` for `styleId` param the code of injection will set the `id` attribute of the `style` element with the value of the parameter provided.\r\nThis is an example:\r\n```ts\r\nimport cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'\r\n\r\nexport default {\r\n  plugins: [\r\n    cssInjectedByJsPlugin({styleId: \"foo\"}),\r\n  ]\r\n}\r\n```\r\nThe output injected into the DOM will look like this example:\r\n```html\r\n<head>\r\n    <style id=\"foo\">/* Generated CSS rules */</style>\r\n</head>\r\n```\r\n\r\n## Contributing\r\nWhen you make changes to plugin locally, you may want to build the js from the typescript file of the plugin. \r\nHere the guidelines:\r\n### Install\r\n```\r\nnpm install\r\n```\r\n### Build plugin\r\n```\r\nnpm run build\r\n```\r\n\r\nSee CONTRIBUTING.md for more information.\r\n","readmeFilename":"README.md"}