JSPM

  • Created
  • Published
  • Downloads 196108
  • Score
    100M100P100Q181560F
  • License MIT

A Vite plugin that takes the CSS and adds it to the page through the JS. For those who want a single JS file.

Package Exports

  • vite-plugin-css-injected-by-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-css-injected-by-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vite-plugin-css-injected-by-js

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.

Usage

import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'

export default {
  plugins: [
    cssInJsPlugin(),
  ]
}

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.