New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

css-content-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-content-loader

CSS content loader for webpack

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

css-content-loader

CSS content loader for webpack

Build Status Coverage Status Dependency Status devDependency Status

Why this loader? We use style-loader as the last loader for style files and it will insert a <style> or <link> tag into the html doc. In most cases, it's enough and works perfectly.

However, what if we just want to get the style content as string directly! Like I just want require the style content in code and process the string. This loader is for this corner case.

Install

NPM

Usage

Documentation: Using loaders

var cssContent = require('css-content!./file.css');
// => returns css code as string from file.css
// cssContent is string like `body { margin: 0; }`

var cssContent2 = require('css-content!css!postcss!sass!./file.scss');
// recommend to use with css-loader and other style loaders.
// and css-content-loader will get the compiled css content as string.

loader config

Currently no special config is needed for css-content-loader. It works well with css-loader.

module.exports = {
    module: {
        loaders: [
            { test: /\.css$/, loader: "content-loader!css-loader" },
            { test: /\.png$/, loader: "url-loader?limit=100000" },
            { test: /\.jpg$/, loader: "file-loader" }
        ]
    }
};

License

MIT

Keywords

FAQs

Package last updated on 09 Apr 2016

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