vite-plugin-css-injected-by-js
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -29,3 +29,3 @@ "use strict"; | ||
//IIFE http://benalman.com/news/2010/11/immediately-invoked-function-expression/ | ||
chunk.code += `(function(){ try {var elementStyle = document.createElement('style'); elementStyle.innerText = \`${styleCode}\`; document.head.appendChild(elementStyle);} catch(e) {console.error(e, 'vite-plugin-css-injected-by-js: can't add the style.');} })()`; | ||
chunk.code += `(function(){ try {var elementStyle = document.createElement('style'); elementStyle.innerText = \`${styleCode}\`; document.head.appendChild(elementStyle);} catch(e) {console.error(e, 'vite-plugin-css-injected-by-js: can\\'t add the style.');} })()`; | ||
break; | ||
@@ -32,0 +32,0 @@ } |
{ | ||
"name": "vite-plugin-css-injected-by-js", | ||
"version": "1.0.0", | ||
"version": "1.0.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.", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.js", |
@@ -1,7 +0,13 @@ | ||
# vite-plugin-css-injected-by-js | ||
# Vite Plugin: CssInjectedByJs | ||
A Vite plugin that takes the CSS and adds it to the page through the JS. For those who want a single JS file. | ||
## How does it work | ||
Essentially what it does is take all the CSS generated by the build process and add it through javascript. The CSS file is therefore not generated and the declaration in the generated HTML file is also removed. | ||
Essentially what it does is take all the CSS generated by the build process and add it through javascript. | ||
The CSS file is therefore not generated and the declaration in the generated HTML file is also removed. | ||
## Installation | ||
``` | ||
npm i vite-plugin-css-injected-by-js --save | ||
``` | ||
## Usage | ||
@@ -18,4 +24,14 @@ ```ts | ||
## Contributions | ||
This is one of the first Vite plugins I do, feel free to open issues and PR. The important thing is that the PRs are created by the develop branch and that everything is explained through the comment and correlated issue. | ||
## Contributing | ||
When you make changes to plugin locally, you may want to build the js from the typescript file of the plugin. | ||
Here the guidelines: | ||
### Install | ||
``` | ||
npm install | ||
``` | ||
### Build plugin | ||
``` | ||
npm run build | ||
``` | ||
See CONTRIBUTING.md for more information. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6582
37