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.5.1 to 0.5.2

.travis.yml

28

index.js

@@ -8,16 +8,11 @@ /*

this.cacheable && this.cacheable();
var isRequireUrl = !this || !this.options || !this.options.css ||
typeof this.options.css.requireUrl === "string";
var requireUrl = this && this.options && this.options.css &&
this.options.css.requireUrl;
if(typeof requireUrl !== "string") requireUrl = "!file!";
var result = [];
var tree = csso.parse(content, "stylesheet");
if(this && this.minimize)
if(this && this.minimize) {
tree = csso.compress(tree);
tree = csso.cleanInfo(tree);
tree = csso.cleanInfo(tree);
}
var imports = extractImports(tree);
if(isRequireUrl)
annotateUrls(tree);
annotateUrls(tree);

@@ -35,11 +30,8 @@ imports.forEach(function(imp) {

var css = JSON.stringify(csso.translate(tree));
if(isRequireUrl) {
var uriRegExp = /%CSSURL\[%(.*?)%\]CSSURL%/g;
css = css.replace(uriRegExp, function(str) {
match = /^%CSSURL\[%(.*?)%\]CSSURL%$/.exec(str);
var url = JSON.parse("\"" + match[1] + "\"");
return "\"+require(" + JSON.stringify(requireUrl + urlToRequire(url)) + ")+\"";
});
}
var uriRegExp = /%CSSURL\[%(.*?)%\]CSSURL%/g;
css = css.replace(uriRegExp, function(str) {
var match = /^%CSSURL\[%(.*?)%\]CSSURL%$/.exec(str);
var url = JSON.parse("\"" + match[1] + "\"");
return "\"+require(" + JSON.stringify(urlToRequire(url)) + ")+\"";
});
result.push(css);

@@ -46,0 +38,0 @@ return "module.exports =\n\t" + result.join(" +\n\t") + ";";

{
"name": "css-loader",
"version": "0.5.1",
"version": "0.5.2",
"author": "Tobias Koppers @sokra",

@@ -10,6 +10,7 @@ "description": "css loader module for webpack",

"devDependencies": {
"vows": "0.6.2"
"mocha": "1.8.x",
"should": "1.1.x"
},
"scripts": {
"test": "node node_modules/vows/bin/vows"
"test": "mocha --reporter spec"
},

@@ -16,0 +17,0 @@ "licenses": [

@@ -12,16 +12,8 @@ # css loader for webpack

`url(...)` will be required with the loader specified in the options.
If `options.css.requireUrl` is a string it will be prefixed to the required url.
If it isn't a string `url(...)` will not be replaced.
`options.css.requireUrl` defaults to `"file/auto!"`.
`url(...)` will be required. You should define useful loaders by config.
A alternative to the file-loader is the
[url-loader](https://github.com/sokra/webpack-url-loader) which can use Data Urls.
The use it specify `"url/auto!"`.
Good loaders to require these files is the [file-loader](https://github.com/webpack/file-loader) and the [url-loader](https://github.com/webpack/url-loader).
Don't forget to polyfill `require` if you want to use it in node.
See `webpack` documentation.
## License
MIT (http://www.opensource.org/licenses/mit-license.php)
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