css-loader
Advanced tools
Comparing version 0.6.2 to 0.6.3
28
index.js
@@ -12,3 +12,3 @@ /* | ||
var tree = csso.parse(content, "stylesheet"); | ||
if(this && this.minimize) { | ||
if(tree && this && this.minimize) { | ||
tree = csso.compress(tree); | ||
@@ -18,16 +18,18 @@ tree = csso.cleanInfo(tree); | ||
var imports = extractImports(tree); | ||
annotateUrls(tree); | ||
if(tree) { | ||
var imports = extractImports(tree); | ||
annotateUrls(tree); | ||
imports.forEach(function(imp) { | ||
if(imp.media.length > 0) { | ||
result.push(JSON.stringify("@media " + imp.media.join("") + "{")); | ||
} | ||
result.push("require(" + JSON.stringify("!" + __filename + "!" + urlToRequire(imp.url)) + ")"); | ||
if(imp.media.length > 0) { | ||
result.push(JSON.stringify("}")); | ||
} | ||
}); | ||
imports.forEach(function(imp) { | ||
if(imp.media.length > 0) { | ||
result.push(JSON.stringify("@media " + imp.media.join("") + "{")); | ||
} | ||
result.push("require(" + JSON.stringify("!" + __filename + "!" + urlToRequire(imp.url)) + ")"); | ||
if(imp.media.length > 0) { | ||
result.push(JSON.stringify("}")); | ||
} | ||
}); | ||
} | ||
var css = JSON.stringify(csso.translate(tree)); | ||
var css = JSON.stringify(tree ? csso.translate(tree) : ""); | ||
var uriRegExp = /%CSSURL\[%(.*?)%\]CSSURL%/g; | ||
@@ -34,0 +36,0 @@ css = css.replace(uriRegExp, function(str) { |
{ | ||
"name": "css-loader", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "css loader module for webpack", |
@@ -12,8 +12,6 @@ # css loader for webpack | ||
`@import` will be required with this css loader. | ||
`@import` and `url(...)` are interpreted like `require()` and will be resolved by the css-loader. | ||
Good loaders for requiring your assets are the [file-loader](https://github.com/webpack/file-loader) | ||
and the [url-loader](https://github.com/webpack/url-loader) which you should specify in your config (see below). | ||
`url(...)` will be required. You should define useful loaders by config. | ||
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). | ||
### Example config | ||
@@ -26,7 +24,7 @@ | ||
module: { | ||
loaders: { | ||
loaders: [ | ||
{ test: /\.css/, loader: "style-loader!css-loader" }, | ||
{ test: /\.png/, loader: "url-loader?limit=100000&minetype=image/png" }, | ||
{ test: /\.jpg/, loader: "file-loader" } | ||
} | ||
] | ||
} | ||
@@ -33,0 +31,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5378
127
35