Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
72f4e5d6
Commit
72f4e5d6
authored
Dec 15, 2006
by
Steven Wittens
Browse files
#102877
: Don't let the css preprocessor mess up @import in some themes.
parent
46392b26
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/common.inc
View file @
72f4e5d6
...
...
@@ -1487,10 +1487,10 @@ function drupal_build_css_cache($types, $filename) {
$contents
=
file_get_contents
(
$file
);
// Return the path to where this CSS file originated from, stripping off the name of the file at the end of the path.
$path
=
base_path
()
.
substr
(
$file
,
0
,
strrpos
(
$file
,
'/'
))
.
'/'
;
// Wraps all @import arguments in url().
$contents
=
preg_replace
(
'/@import\s+(?!url)[\'"]?(\S*)\b[\'"]?/i'
,
'@import url("\1")'
,
$contents
);
// Fix all paths within this CSS file, ignoring absolute paths.
$contents
=
preg_replace
(
'/url\(([\'"]?)(?![a-z]+:)/i'
,
'url(\1'
.
$path
.
'\2'
,
$contents
);
// Fix any @import that don't use url() and is not absoslute.
$data
.
=
preg_replace
(
'/@import\s*([\'"]?)(?![a-z]+:)/i'
,
'@import \1'
.
$path
.
'\2'
,
$contents
);
$data
.
=
preg_replace
(
'/url\(([\'"]?)(?![a-z]+:)/i'
,
'url(\1'
.
$path
.
'\2'
,
$contents
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment