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

Commit

Permalink
fix(css): stop using @extend for rules in a different module.
Browse files Browse the repository at this point in the history
  • Loading branch information
jelbourn committed Jun 22, 2015
1 parent 45005f2 commit d821d19
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 26 deletions.
4 changes: 4 additions & 0 deletions gulp/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var IS_DEV = constants.IS_DEV;
var ROOT = constants.ROOT;
var utils = require('../scripts/gulp-utils.js');

var print = require('gulp-print');

exports.buildJs = buildJs;
exports.autoprefix = autoprefix;
exports.buildModule = buildModule;
Expand Down Expand Up @@ -147,11 +149,13 @@ function buildModule(module, isRelease) {
return fs.readFileSync(fileName, 'utf8').toString();
}).join('\n');

console.log(baseStyles);
return lazypipe()
.pipe(insert.prepend, baseStyles)
.pipe(gulpif, /theme.scss/,
rename(name + '-default-theme.scss'), concat(name + '.scss')
)
.pipe(print)
.pipe(sass)
.pipe(autoprefix)
(); // invoke the returning fn to create our pipe
Expand Down
8 changes: 4 additions & 4 deletions src/components/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ $icon-button-margin: rem(0.600) !default;

&.md-raised {
&:not([disabled]) {
@extend .md-shadow-bottom-z-1;
@include md-shadow-bottom-z-1();
}
}

Expand Down Expand Up @@ -136,7 +136,7 @@ $icon-button-margin: rem(0.600) !default;
flex-grow: 0;
flex-shrink: 0;

@extend .md-shadow-bottom-z-1;
@include md-shadow-bottom-z-1();
border-radius: 50%;
background-clip: padding-box;
overflow: hidden;
Expand All @@ -163,10 +163,10 @@ $icon-button-margin: rem(0.600) !default;
&.md-raised,
&.md-fab {
&.md-focused {
@extend .md-shadow-bottom-z-1;
@include md-shadow-bottom-z-1();
}
&:active {
@extend .md-shadow-bottom-z-2;
@include md-shadow-bottom-z-2();
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ md-list {
padding: $list-padding-top $list-padding-right $list-padding-bottom $list-padding-left;

.md-subheader {
@extend .md-body-2;
@include md-body-2();
line-height: $list-header-line-height;
}
}
Expand Down Expand Up @@ -177,18 +177,18 @@ md-list-item.md-3-line > .md-no-style {
}

h3 {
@extend .md-subhead;
@include md-subhead();
margin: $list-h3-margin;
line-height: $list-header-line-height;
}
h4 {
@extend .md-body-2;
@include md-body-2();
font-weight: $list-h4-font-weight;
margin: $list-h4-margin;
line-height: $list-header-line-height;
}
p {
@extend .md-body-2;
@include md-body-2();
margin: $list-p-margin;
line-height: $list-p-line-height;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/toolbar/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ md-toolbar {
}

.md-toolbar-tools {
@extend .md-title;
@include md-title();
font-weight: 400;
display: flex;
align-items: center;
Expand Down
37 changes: 37 additions & 0 deletions src/core/style/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,43 @@
}
}

@mixin md-shadow-bottom-z-1() {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
}

@mixin md-shadow-bottom-z-2() {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4);
}

// Typography mixins

@mixin md-title() {
font-size: $title-font-size-base;
font-weight: 500;
letter-spacing: 0.005em;
}

@mixin md-body-1() {
font-size: $body-font-size-base;
font-weight: 400;
letter-spacing: 0.010em;
line-height: rem(2);
}

@mixin md-body-2() {
font-size: $body-font-size-base;
font-weight: 500;
letter-spacing: 0.010em;
line-height: rem(2.4);
}

@mixin md-subhead() {
font-size: $subhead-font-size-base;
font-weight: 400;
letter-spacing: 0.010em;
line-height: rem(2.4);
}

@function map-to-string($map) {
$map-str: '{';
$keys: map-keys($map);
Expand Down
4 changes: 2 additions & 2 deletions src/core/style/structure.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ input {
}

.md-shadow-bottom-z-1 {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
@include md-shadow-bottom-z-1();
}
.md-shadow-bottom-z-2 {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4);
@include md-shadow-bottom-z-2();
}

.md-shadow-animated.md-shadow {
Expand Down
19 changes: 4 additions & 15 deletions src/core/style/typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,19 @@ ul, ol, p, h1, h2, h3, h4, h5, h6 {
line-height: rem(3.2);
}
.md-title {
font-size: $title-font-size-base;
font-weight: 500;
letter-spacing: 0.005em;
@include md-title();
}
.md-subhead {
font-size: $subhead-font-size-base;
font-weight: 400;
letter-spacing: 0.010em;
line-height: rem(2.4);
@include md-subhead();
}
/************
* Body Copy
************/
.md-body-1 {
font-size: $body-font-size-base;
font-weight: 400;
letter-spacing: 0.010em;
line-height: rem(2);
@include md-body-1();
}
.md-body-2 {
font-size: $body-font-size-base;
font-weight: 500;
letter-spacing: 0.010em;
line-height: rem(2.4);
@include md-body-2();
}
.md-caption {
font-size: $caption-font-size-base;
Expand Down

0 comments on commit d821d19

Please sign in to comment.