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

css-loader

Package Overview
Dependencies
Maintainers
1
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-loader - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

47

index.js

@@ -9,3 +9,3 @@ /*

module.exports = function(content) {
module.exports = function(content, map) {
this.cacheable && this.cacheable();

@@ -17,2 +17,3 @@ var result = [];

var forceMinimize = query.minimize;
var importLoaders = parseInt(query.importLoaders, 10) || 0;
var minimize = typeof forceMinimize !== "undefined" ? !!forceMinimize : (this && this.minimize);

@@ -34,3 +35,6 @@ var tree = csso.parse(content, "stylesheet");

var importUrl = "-!" +
this.loaders.slice(this.loaderIndex).map(function(x) { return x.request; }).join("!") + "!" +
this.loaders.slice(
this.loaderIndex,
this.loaderIndex + 1 + importLoaders
).map(function(x) { return x.request; }).join("!") + "!" +
loaderUtils.urlToRequest(imp.url);

@@ -63,21 +67,26 @@ result.push("require(" + JSON.stringify(require.resolve("./mergeImport")) + ")(exports, require(" + JSON.stringify(importUrl) + "), " + JSON.stringify(imp.media.join("")) + ");");

var request = loaderUtils.getCurrentRequest(this);
var sourceMap = new SourceMapGenerator({
file: request
});
var lines = content.split("\n").length;
for(var i = 0; i < lines; i++) {
sourceMap.addMapping({
generated: {
line: i+1,
column: 0
},
source: cssRequest,
original: {
line: i+1,
column: 0
},
if(!map) {
var sourceMap = new SourceMapGenerator({
file: request
});
var lines = content.split("\n").length;
for(var i = 0; i < lines; i++) {
sourceMap.addMapping({
generated: {
line: i+1,
column: 0
},
source: cssRequest,
original: {
line: i+1,
column: 0
},
});
}
sourceMap.setSourceContent(cssRequest, content);
map = JSON.stringify(sourceMap.toJSON());
} else if(typeof map !== "string") {
map = JSON.stringify(map);
}
sourceMap.setSourceContent(cssRequest, content);
result.push("exports.push([module.id, " + css + ", \"\", " + JSON.stringify(sourceMap.toJSON()) + "]);");
result.push("exports.push([module.id, " + css + ", \"\", " + map + "]);");
} else {

@@ -84,0 +93,0 @@ result.push("exports.push([module.id, " + css + ", \"\"]);");

{
"name": "css-loader",
"version": "0.8.0",
"version": "0.9.0",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "css loader module for webpack",

@@ -69,2 +69,20 @@ # css loader for webpack

### importing and chained loaders
The query parameter `importLoaders` allow to configure which loaders should be applied to `@import`ed resources.
`importLoaders` (int): That many loaders after the css-loader are used to import resources.
Examples:
``` js
require("style-loader!css-loader?importLoaders=1!autoprefixer-loader!...")
// => imported resources are handled this way:
require("css-loader?importLoaders=1!autoprefixer-loader!...")
require("style-loader!css-loader!stylus-loader!...")
// => imported resources are handled this way:
require("css-loader!...")
```
### Minification

@@ -71,0 +89,0 @@

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