Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(theming): match preceding selectors as well #9484

Merged
merged 1 commit into from
Sep 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions gulp/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ function autoprefix () {
]});
}

function minifyCss() {
return nano({
function minifyCss(extraOptions) {
var options = {
autoprefixer: false,
reduceTransforms: false,
svgo: false,
safe: true
});
};

return nano(_.assign(options, extraOptions));
}

function buildModule(module, opts) {
Expand Down Expand Up @@ -229,6 +231,8 @@ function themeBuildStream() {
.pipe(utils.hoistScssVariables())
.pipe(sass())
.pipe(dedupeCss())
// The PostCSS orderedValues plugin modifies the theme color expressions.
.pipe(minifyCss({ orderedValues: false }))
.pipe(utils.cssToNgConstant('material.core', '$MD_THEME_CSS'));
}

Expand Down
7 changes: 4 additions & 3 deletions src/core/services/theming/theming.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,10 @@ function parseRules(theme, colorType, rules) {
// Don't apply a selector rule to the default theme, making it easier to override
// styles of the base-component
if (theme.name == 'default') {
var themeRuleRegex = /((?:(?:(?: |>|\.|\w|-|:|\(|\)|\[|\]|"|'|=)+) )?)((?:(?:\w|\.|-)+)?)\.md-default-theme((?: |>|\.|\w|-|:|\(|\)|\[|\]|"|'|=)*)/g;
newRule = newRule.replace(themeRuleRegex, function(match, prefix, target, suffix) {
return match + ', ' + prefix + target + suffix;
var themeRuleRegex = /((?:\s|>|\.|\w|-|:|\(|\)|\[|\]|"|'|=)*)\.md-default-theme((?:\s|>|\.|\w|-|:|\(|\)|\[|\]|"|'|=)*)/g;

newRule = newRule.replace(themeRuleRegex, function(match, start, end) {
return match + ', ' + start + end;
});
}
generatedRules.push(newRule);
Expand Down