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

style-loader

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-loader - npm Package Compare versions

Comparing version 0.2.1 to 0.5.0

15

addStyle.js

@@ -1,1 +0,14 @@

module.exports = function() {}
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function(cssCode) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = cssCode;
} else {
styleElement.appendChild(document.createTextNode(cssCode));
}
document.getElementsByTagName("head")[0].appendChild(styleElement);
}

21

index.js

@@ -6,12 +6,15 @@ /*

var path = require("path");
module.exports = function(content) {
module.exports = function() {};
module.exports.pitch = function(remainingRequest) {
this.cacheable && this.cacheable();
this.clearDependencies && this.clearDependencies();
if(this.loaderType != "loader") throw new Error("style-loader do not work as pre or post loader");
var rawCss = this.currentLoaders.slice(this.loaderIndex+1).join("!") + "!" + this.filenames[0];
if(this.web)
return "require(" + JSON.stringify(path.join(__dirname, "addStyle")) + ")"+
"(require(" + JSON.stringify(rawCss) + "))";
return "";
}
var cssCodeRequest = "require(" + JSON.stringify("!!" + remainingRequest) + ")";
var addStyleCode = "require(" + JSON.stringify("!" + path.join(__dirname, "addStyle.js")) + ")";
var footer = "";
if(this.debug) {
footer = "\n\n/* STYLE-LOADER FOOTER */\n/*@ sourceURL=style:///" +
encodeURI(remainingRequest.replace(/^!/, "")).replace(/%5C|%2F/g, "/").replace(/\?/, "%3F").replace(/^\//, "") + " */";
footer = "+" + JSON.stringify(footer);
}
return addStyleCode + "(" + cssCodeRequest + footer + ")";
};
module.exports.seperable = true;
{
"name": "style-loader",
"version": "0.2.1",
"version": "0.5.0",
"author": "Tobias Koppers @sokra",

@@ -11,4 +11,3 @@ "description": "style loader module for webpack",

}
],
"license": "MIT"
]
}

@@ -12,3 +12,3 @@ # style loader for webpack

It's recommended to combine it with the [`css`](https://github.com/sokra/webpack-css-loader) loader: `require("style!css!./file.css")`.
It's recommended to combine it with the [`css`](https://github.com/webpack/css-loader) loader: `require("style!css!./file.css")`.

@@ -15,0 +15,0 @@ ## License

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