resolve-url-loader
Advanced tools
Comparing version 1.0.3 to 1.1.0
26
index.js
@@ -45,7 +45,23 @@ /* | ||
// process | ||
return rework(content) | ||
.use(reworkPlugin) | ||
.toString({ | ||
sourcemap: this.sourceMap || options.sourceMap | ||
}); | ||
// rework will throw on css syntax errors | ||
var FILENAME_PLACEHOLDER = '<filename>'; | ||
try { | ||
return rework(content, { source: FILENAME_PLACEHOLDER }) | ||
.use(reworkPlugin) | ||
.toString({ | ||
sourcemap: this.sourceMap || options.sourceMap | ||
}); | ||
} | ||
// fail gracefully | ||
catch(exception) { | ||
var message = ('CSS syntax error (resolve-url-loader did not operate)' + exception.message) | ||
.replace(FILENAME_PLACEHOLDER, ''); | ||
if (options.fail) { | ||
this.emitError(message); | ||
} | ||
else if (!options.silent) { | ||
this.emitWarning(message); | ||
} | ||
return content; // original content unchanged | ||
} | ||
@@ -52,0 +68,0 @@ /** |
{ | ||
"name": "resolve-url-loader", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Webpack loader that resolves relative paths in url() statements based on the original source file", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,2 +43,5 @@ # Resolve URL Loader | ||
In some use cases (no preceding transpiler) there will be no incoming source map. Therefore we do not warn if the | ||
source-map is missing. | ||
### Apply via webpack config | ||
@@ -72,2 +75,6 @@ | ||
* `silent` Do not display warnings on CSS syntax error. | ||
* `fail` Syntax errors will result in an error. | ||
## How it works | ||
@@ -74,0 +81,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
13232
221
90