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

@microsoft/loader-load-themed-styles

Package Overview
Dependencies
Maintainers
2
Versions
660
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/loader-load-themed-styles

This simple loader wraps the loading of CSS in script equivalent to `require('load-themed-styles').loadStyles( /* css text */ )`. It is designed to be a replacement for style-loader.

  • 2.1.76
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
decreased by-12.35%
Maintainers
2
Weekly downloads
 
Created
Source

@microsoft/loader-load-themed-styles

Installation

npm install @microsoft/loader-load-themed-styles --save-dev

Overview

This simple Webpack loader that wraps the loading of CSS in script equivalent to require("load-themed-styles").loadStyles( /* css text */ ). It is designed to be a replacement for style-loader.

Usage

Documentation: Using loaders

This loader is designed to be used in conjunction with css-loader.

var css = require("@microsoft/loader-load-themed-styles!css!./file.css");
// => returns css code from file.css, uses load-themed-styles to load the CSS on the page.

Example config

        use: [
          {
            loader: "@microsoft/loader-load-themed-styles",  // creates style nodes from JS strings
            options: {
              async: false
            }
          },
          {
            loader: "css-loader", // translates CSS into CommonJS
            options: {
              modules: true,
              importLoaders: 2,
              localIdentName: '[name]_[local]_[hash:base64:5]',
              minimize: false
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              plugins: function () {
                return [
                  require('autoprefixer')
                ];
              }
            }
          },
          {
            loader: "sass-loader",
          }
        ]

Options

async (boolean, defaults to false)

By default, @microsoft/load-themed-styles loads styles synchronously. This can have adverse performance effects if many styles are loaded in quick succession. If the async option is set to true, the loadStyles function is called with the second parameter set to true, directing the function to debounce style loading causing fewer changes to the DOM.

  • CHANGELOG.md - Find out what's new in the latest version

@microsoft/loader-load-themed-styles is part of the Rush Stack family of projects.

FAQs

Package last updated on 03 Dec 2024

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