1.0.3 • Published 4 years ago

@supl.biz_tech/css-inliner v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

css-inliner

yarn add @supl.biz_tech/css-inliner

Setup

Use the provided Rollup plugin:

const { plugin } = require('@supl.biz_tech/css-inliner');

module.exports = {
  // ...
  plugins: [
    // ...
    // make sure this plugin is called last
    plugin({
      // optional, default: css-inliner-manifest.json
      // outputFileName: 'some-manifest.json',
    }),
  ],
};

Use the provided render function in your SSR code:

const { render } = require('@supl.biz_tech/css-inliner');

const tags = render({
  manifestPath: './build/css-inliner-manifest.json',
  stylesheetPath: 'https://my-site.com/css/my-css-bundle.css',
  htmlFragment: '<div>HTML generated during SSR</div>',
  logError(error) {
    // probably should send this error to Sentry or some alternative
    console.error(error);
  },
});

const pageHTML = `
  <html>
    <head>
      ...
      ${tags}
    </head>
    ...
  </html>
`;
1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago