refactor(styles): make all of the styles modular #2172
Conversation
|
@johngruen I can help diagnose. Initial theory is that it's a grunt-sass version issue. It seems like fxa-content-server is using grunt-sass@0.14.0 and Chronicle is using grunt-sass@0.18.0. I'll grab this branch and play around locally and run it through scss-lint. |
|
|
||
| body { | ||
| color: $text-color; | ||
| @include font(); |
pdehaan
Mar 3, 2015
Contributor
Move the include() above the color declaration?
Move the include() above the color declaration?
| h1, | ||
| h2, | ||
| h3 { | ||
| @include headerFont(); |
pdehaan
Mar 3, 2015
Contributor
_app/styles/base.scss:43 [W] NameFormat: Name of mixin headerFont should be written in all lowercase letters with hyphens instead of underscores
Meh. Not sure if you really want to follow all the scss-lint suggestions, or if we maybe want to disable some of them in the aoo/styles/.scss-lint.yml file.
_app/styles/base.scss:43 [W] NameFormat: Name of mixin
headerFontshould be written in all lowercase letters with hyphens instead of underscores
Meh. Not sure if you really want to follow all the scss-lint suggestions, or if we maybe want to disable some of them in the aoo/styles/.scss-lint.yml file.
johngruen
Mar 3, 2015
Author
Contributor
@pdehaan: stop linting! I haven't done this yet, and it's gonna make you go insane
@pdehaan: stop linting! I haven't done this yet, and it's gonna make you go insane
pdehaan
Mar 3, 2015
Contributor
Yeah, actually the linting isn't that bad. Mostly "Avoid using id selectors.", which I feel like we should turn off since we're all grown-ups. Same with "Avoid qualifying class selectors with an element."
Most of the rest of the lint noise was from the app/styles/_media_queries.scss file which hasn't been touched.
Yeah, actually the linting isn't that bad. Mostly "Avoid using id selectors.", which I feel like we should turn off since we're all grown-ups. Same with "Avoid qualifying class selectors with an element."
Most of the rest of the lint noise was from the app/styles/_media_queries.scss file which hasn't been touched.
| font-family: $header-font; | ||
| } | ||
|
|
||
| @mixin formElement() { |
pdehaan
Mar 3, 2015
Contributor
Not sure if these mixins should be header-font() and form-element() to be consistent w/ hidpi-background-image().
Not sure if these mixins should be header-font() and form-element() to be consistent w/ hidpi-background-image().
| @import 'modules/cropper'; | ||
| @import 'modules/graphic'; | ||
| @import 'modules/marketing'; | ||
|
|
pdehaan
Mar 3, 2015
Contributor
If these aren't in a specific order, we could auto-gen this file using something like grunt-sass-globbing (if that's marginally easier to maintain).
Should be some fairly trivial Grunt (and I can do it in a future PR). We'd just have to set up the "sass_globbing" task to generate this "app/styles/_modules.scss" file, and then add the generated file to the .gitignore file, and then run the "sass_globbing" task before the main "sass" task.
If these aren't in a specific order, we could auto-gen this file using something like grunt-sass-globbing (if that's marginally easier to maintain).
Should be some fairly trivial Grunt (and I can do it in a future PR). We'd just have to set up the "sass_globbing" task to generate this "app/styles/_modules.scss" file, and then add the generated file to the .gitignore file, and then run the "sass_globbing" task before the main "sass" task.
| //this file still needs to go | ||
| // will be replaced by _breakpoints.scss | ||
| @import 'media_queries'; | ||
|
|
pdehaan
Mar 3, 2015
Contributor
The aforementioned sass_globbing trick wouldn't work here since I think these are in a very specific order.
The aforementioned sass_globbing trick wouldn't work here since I think these are in a very specific order.
|
@johngruen On the topic of errors, where were you seeing the Sass error? Running "connect_fonts" task
Warning: Cannot call method 'filter' of undefined Use --force to continue.
Aborted due to warnings.Running just the "sass" task (via $ grunt sass
Running "sass:styles" (sass) task
File app/styles/system-font-main.css created.
File app/styles/sync.css created.
File app/styles/main.css created.
Done, without errors. |
| @@ -1,5 +1,5 @@ | |||
| //Font Family Variables | |||
| $default-font: "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; | |||
| $default-font:"Fira Sans", Helvetica, Arial, sans-serif; | |||
pdehaan
Mar 3, 2015
Contributor
Interesting! Does this change anything significant by switching from "Clear Sans" to "Fira Sans"?
Interesting! Does this change anything significant by switching from "Clear Sans" to "Fira Sans"?
johngruen
Mar 3, 2015
Author
Contributor
@pdehaan: Ryan and were talking about nuking Clear Sans, just wanted to see what it would look like. this is probably not going to survive the final version of this PR
@pdehaan: Ryan and were talking about nuking Clear Sans, just wanted to see what it would look like. this is probably not going to survive the final version of this PR
pdehaan
Mar 3, 2015
Contributor
Might I suggest something like Comic Neue, for increased whimsy and playfulness. /cc @ryanfeeley
Might I suggest something like Comic Neue, for increased whimsy and playfulness. /cc @ryanfeeley
|
|
||
| .pulse { | ||
| animation-duration: $medium-transition; | ||
| animation-name: pulse; |
pdehaan
Mar 3, 2015
Contributor
Any preferences toward using the separate animation-duration and animation-name styles versus the shorthand notation of animation like in .shake, .fadein, etc.?
Any preferences toward using the separate animation-duration and animation-name styles versus the shorthand notation of animation like in .shake, .fadein, etc.?
johngruen
Mar 3, 2015
Author
Contributor
@pdehaan: i will wind up shortening, i just wanted to get everything moved into new homes before reworking the individual bits.
@pdehaan: i will wind up shortening, i just wanted to get everything moved into new homes before reworking the individual bits.
| margin-top: 10px; | ||
| } | ||
|
|
||
| /* Animation triggering classes */ |
pdehaan
Mar 3, 2015
Contributor
I'm not 100% on your naming structures, or if it's worth abstracting all these glorious animations into a separate module like _modules/animation.scss to keep them separated but together.
I'm not 100% on your naming structures, or if it's worth abstracting all these glorious animations into a separate module like _modules/animation.scss to keep them separated but together.
| input::-moz-placeholder, /* Firefox 19+ */ | ||
| input:-ms-input-placeholder { | ||
| color: $input-placeholder-color; | ||
| } |
pdehaan
Mar 3, 2015
Contributor
Interesting... Doesn't Autoprefixer do this magic for us? Or are we explicitly specifying 18- rules because Autoprefixer doesn't generate prefixes for that far back into the past?
Interesting... Doesn't Autoprefixer do this magic for us? Or are we explicitly specifying 18- rules because Autoprefixer doesn't generate prefixes for that far back into the past?
johngruen
Mar 3, 2015
Author
Contributor
@pdehaan: not sure. probablhy worth tracking down @shane-tomlinson to answer that for us. These were in the Sass before i moved stuff around. Maybe it has to do with 18 being ESR?
@pdehaan: not sure. probablhy worth tracking down @shane-tomlinson to answer that for us. These were in the Sass before i moved stuff around. Maybe it has to do with 18 being ESR?
|
you see the error if you uncomment line 3 in looks like this: |
|
|
||
| input[type='email'], | ||
| input[type='text'] { | ||
| } |
pdehaan
Mar 3, 2015
Contributor
What up with the empty rule, bro?
What up with the empty rule, bro?
johngruen
Mar 3, 2015
Author
Contributor
dude, this has been SHIPPING believe it or not check out https://github.com/mozilla/fxa-content-server/blob/master/app/styles/_general.scss#L382
dude, this has been SHIPPING believe it or not check out https://github.com/mozilla/fxa-content-server/blob/master/app/styles/_general.scss#L382
|
@pdehaan also, why do we use grunt-sass over grunt-contrib-sass? |
"This task uses libsass which is a Sass compiler in C++." libsass is faster |
GLAD YOU ASKED!!! The grunt-contrib-sass package "requires that you have Ruby and Sass installed" (per https://github.com/gruntjs/grunt-contrib-sass#sass-task). Sometimes managing Ruby and Sass and making sure we're all on the same version can be gross and makes me sad in my space where my heart would be. The grunt-sass package is "super awesome"(tm) and uses libsass (which is a Sass compiler in C++). It's allegedly faster than the Ruby compiler, but doesn't have as many features, blah blah blah. |
|
@vladikoff @pdehaan cool |
|
also @pdehaan updated |
|
@johngruen I think something got messed up, cause it works for me. Before: $ grunt sass
Running "sass:styles" (sass) task
Warning: /Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/app/styles/breakpoints:4: error: error reading values after small
Use --force to continue.
Aborted due to warnings.After: $ grunt sass
Running "sass:styles" (sass) task
Done, without errors.You may want to confirm your grunt-sass version number in the package.json file, and you may also need to nuke the npm-shrinkwrap.json file, since that usually tries to enforce which versions get installed. |
d21a557
to
9cec07a
| @warn 'Unfortunately, no value could be retrieved from `#{$breakpoint}`. ' | ||
| + 'Please make sure it is defined in `$breakpoints` map.'; | ||
| } | ||
| } |
pdehaan
Mar 5, 2015
Contributor
I like the organization of breakpoints, but does the @mixin make more sense here, or in _./app/styles/mixins.scss?
I guess similarly, should we leave the breakpoints here in this file, or just in the _./app/styles/variables.scss file?
I like the organization of breakpoints, but does the @mixin make more sense here, or in _./app/styles/mixins.scss?
I guess similarly, should we leave the breakpoints here in this file, or just in the _./app/styles/variables.scss file?
|
@pdehaan: WRT your last comment, i think its kind of a wash. I did it as a standalone because (a) it seems kind of special somehow and (b) it seemed nice to define the breakpoint object (or whatever that thing is called in sass-land) with the mixin itself. FWIW, here's how the modules are going to look: #fox-logo {
@include hidpi-background-image('firefox', 80px 85px);
background-position: center top;
background-repeat: no-repeat;
opacity: 0;
position: relative;
z-index: $fox-logo-zindex;
@include respond-to('small') {
background-size: 48px 51px;
height: 51px;
margin: 10px auto 0 auto;
top: 0;
width: 100%;
}
@include respond-to('big') {
height: 85px;
margin: 0 auto;
top: 30px;
width: 80px;
}
&.static {
opacity: 1;
}
// IE < 10 does not support CSS transforms
.lt-ie10 & {
opacity: 1;
}
}
#about-mozilla {
@include respond-to('small') {
display: none;
}
@include respond-to('big') {
@include hidpi-background-image('mozilla', 69px 19px);
cursor: pointer;
height: 19px;
opacity: 0.5;
position: absolute;
right: 12px;
top: 12px;
transition: opacity $short-transition;
width: 69px;
&:hover {
opacity: 1;
}
&:focus {
outline-color: $html-background-color;
}
}
}
|
|
Weird, I'm currently seeing this error when I try and run UPDATE: Looks like Travis is choking as well for some reason: https://travis-ci.org/mozilla/fxa-content-server/builds/53400026#L532 UPDATE^2: Looks like if I re-re-delete my ./node_modules/ directory and blow away the npm-shrinkwrap file, then it installs and runs fine: $ grunt sass
Running "sass:styles" (sass) task
Done, without errors. |
|
@johngruen Is this still WIP, or is it ready for a rebase+merge? |
|
OK, I spent an hour manually going through a bunch of flows and clicking links and everything on https://ux.dev.lcip.org/looks fantastic. Great work @johngruen! |
|
Thanks @pdehaan! Looks like it needs a rebase, which is mildly concerning about whether we need a further look-see or not, depending on whether the rebase touches anything touched by this PR. @johngruen what do you think? |
|
@johngruen , maybe delete your npm-shrinkwrap update, amend commit, rebase with master, update shrinkwrap, amend commit, update pr? |
|
@johngruen The good news is that the style-wars branch is in this repo, so if you're truly at a loss, you can punt and get @shane-tomlinson or @vladikoff to resolve the shrinkwrap |
|
Hmmm, @vladikoff followed your advice and now i'm failing...could use an assist getting this one to turn green! |
|
@vladikoff @pdehaan I re-ran |
|
@johngruen Yeap! |
| @@ -48,7 +48,7 @@ | |||
| "grunt-po2json": "git://github.com/shane-tomlinson/grunt-po2json.git#c1a7406", | |||
| "grunt-requirejs": "0.4.2", | |||
| "grunt-rev": "0.1.0", | |||
| "grunt-sass": "0.14.0", | |||
| "grunt-sass": "^0.18.1", | |||
zaach
Mar 23, 2015
Contributor
Let's use the exact version (no ^).
Let's use the exact version (no ^).
| } | ||
|
|
||
| /** | ||
| * IE8 blows up when changing the type of the password field |
shane-tomlinson
Mar 23, 2015
Member
Do we need this anymore since we no longer support IE8?
Do we need this anymore since we no longer support IE8?
johngruen
Mar 23, 2015
Author
Contributor
@shane-tomlinson: probably not, but there's some test code in app/scripts/vendor/env-test.js that goes along with these styles. Maybe we do a separate bug to back out ie legacy styles and tests separately?
@shane-tomlinson: probably not, but there's some test code in app/scripts/vendor/env-test.js that goes along with these styles. Maybe we do a separate bug to back out ie legacy styles and tests separately?
shane-tomlinson
Mar 23, 2015
Member
@johngruen - sounds good, mind filing an issue to remove IE8 support from CSS except for the "browsehappy" related stuff?
@johngruen - sounds good, mind filing an issue to remove IE8 support from CSS except for the "browsehappy" related stuff?
| } | ||
|
|
||
| /* this one is impossible to do w/o sibling selector | ||
| we may need to add js for IE8*/ |
shane-tomlinson
Mar 23, 2015
Member
We no longer care about IE8, so this comment is irrelevant.
We no longer care about IE8, so this comment is irrelevant.
|
@johngruen - the "/confirm_account_unlock" screen needs to be updated: |
|
@shane-tomlinson /complete_account_unlock as well...pushing now |
|
|
|
r+ from me. |
refactor(styles): make all of the styles modular r=@zaach, @shane-tomlinson, @pdehaan





This is still WIP.
Right now, showing the basic, file structure for our Sass going forward. I still need to go through the styles and unpacking things a bit.
@pdehaan: for some reason the breakpoint mixin we've used on Chronicle is throwing an error here. Could you help me diagnose?