Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@e-goi/css-inliner

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@e-goi/css-inliner

Inline your css 100% in the browser and with no dependencies

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

css-inliner

Inline your css 100% in the browser and with no dependencies

Install

To install the package, you can use npm or yarn:

  yarn add @e-goi/css-inliner

Usage

Import the package on your code

import { cssInliner } from '@e-goi/css-inliner';

Use the main function cssInliner to inject the style on the elements.

cssInliner(
  document.querySelector('html').innerHTML,
  {
    properties: {
      width: true,
      border: true,
      cellpadding: true,
      cellspacing: true
    }
  }
).then(formatted => {
  console.log(formatted);
});

Configuration

The second parameter of cssInliner is a configuration object.

Basic configuration

ConfigurationTypeDefaultDescription
urlstringemptyurl to replace on relative path src and href
preserveMediaQueriesbooleantruedefine if preserver or not @media queries
applyApplyTags-tags to get the styles
propertiesApplyProperties-apply style to some attributes
removeRemoveTags-remove tags after set the css inline

ApplyTags configuration

ConfigurationTypeDefaultDescription
stylebooleantrueapply style tags
linkbooleantrueapply content from link tags

ApplyProperties configuration

ConfigurationTypeDefaultDescription
widthbooleanfalseapply width style to width property
borderbooleanfalseapply border style to table border property
cellpaddingbooleanfalseapply td padding style to table cellpadding property
cellspacingbooleanfalseapply border-spacing style to table cellspacing property

RemoveTags configuration

ConfigurationTypeDefaultDescription
stylebooleantrueremove style tags
linkbooleantrueremove link tags
scriptbooleantrueremove script tags

Keywords

FAQs

Package last updated on 05 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc