options.keepBreaks = options.keepBreaks || false;
+ //active by default
+ if (options.processImport === undefined) {
+ options.processImport = true;
+ }
+
// replace function
if (options.debug) {
var originalReplace = replace;
// replace all escaped line breaks
replace(/\\(\r\n|\n)/mg, '');
- // inline all imports
- replace(function inlineImports() {
- data = CleanCSS._inlineImports(data, {
- root: options.root || process.cwd(),
- relativeTo: options.relativeTo
+ if (options.processImport) {
+ // inline all imports
+ replace(function inlineImports() {
+ data = CleanCSS._inlineImports(data, {
+ root: options.root || process.cwd(),
+ relativeTo: options.relativeTo
+ });
});
- });
- // strip comments with inlined imports
- if (data.indexOf('/*') > -1)
- removeComments();
+ // strip comments with inlined imports
+ if (data.indexOf('/*') > -1) {
+ removeComments();
+ }
+ }
// strip parentheses in urls if possible (no spaces inside)
replace(/url\((['"])([^\)]+)['"]\)/g, function(match, quote, url) {
"@import url(/partials-absolute/base.css);",
".base2{border-width:0}.sub{padding:0}.base{margin:0}"
]
- }, { root: path.join(process.cwd(), 'test', 'data') })
+ }, { root: path.join(process.cwd(), 'test', 'data') }),
+ '@import with option processImport': cssContext({
+ 'of an unknown file': [
+ "@import url(/fake.css);",
+ "@import url(/fake.css);"
+ ]
+ }, {processImport : false})
}).export(module);