stc-inline

1.1.0 • Public • Published

stc-inline

Inline css/javascript in html.

Use inline attribute in <link rel="stylesheet"> or <script> to trigger this.

<script src="/resource/js/a.js" inline></script>

OR you can set {jsinline: true} to inline other js files. The syntax shoulde be like this:

var xxx = {inline: "/resource/js/a.js"}.inline;

Setting datauri to true or a integer number can inline base64-ified small images in CSS. "Small images" is defined by the value of datauri. If datauri is trusy and isn't a number, the treshold will be automatically set to 32.768kb. According to this.

Setting allowRemote to true can request online js/css files and then bundle them in HTML.

Usage

// stc.config.js
stc.workflow({
  inline: {
    plugin: inline,
    include: /\.(html|js|css)$/,
    options: {
      uglify: true,
      datauri: true,
      jsinline: true,
      allowRemote: true
    }
  },
});

Roadmap

  • HTML JS inline support
  • HTML CSS inline support
  • support uglify
  • use cluster if possilbe
  • support {inline: ""}.inline in js files
  • support picture base64-ify in css files
  • MIME lookup for css datauri inline

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i stc-inline

    Weekly Downloads

    6

    Version

    1.1.0

    License

    none

    Last publish

    Collaborators

    • alvarto