Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy/simplify SCSS imports #6073

Merged
merged 6 commits into from
Aug 28, 2018
Merged

Tidy/simplify SCSS imports #6073

merged 6 commits into from
Aug 28, 2018

Conversation

willdurand
Copy link
Member

@willdurand willdurand commented Aug 27, 2018

Fix mozilla/addons#12274


This PR cleans the different SCSS imports to avoid "amo" SCSS to leak in
src/ui or src/core so that "disco" can also use the components in
those directories. Also remove a few unused variables.

In addition, I created one file to import for each app, instead of having
different imports, not always sorted correctly. (I did not create a unique
file for the "core" components yet, though).

Why? It is super difficult to find the right imports all the time, so we
end copy/pasting imports from another file and tweak them if that does not
work. This leads to weird import statements in some files. By having only
one file to import, it makes things easier.

Why (2)? I reviewed a PR and saw some code in disco that was coming from
amo, so I decided to clean up our SCSS a bit.

I built the amo app with master and this PR and did not notice any size
difference. I did not see any visual regression either.

@codecov-io
Copy link

codecov-io commented Aug 27, 2018

Codecov Report

Merging #6073 into master will increase coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    mozilla/addons-frontend#6073      +/-   ##
==========================================
+ Coverage   97.78%   97.93%   +0.15%     
==========================================
  Files         231      231              
  Lines        6044     6635     +591     
  Branches     1152     1304     +152     
==========================================
+ Hits         5910     6498     +588     
- Misses        119      123       +4     
+ Partials       15       14       -1
Impacted Files Coverage Δ
src/amo/components/RatingManager/index.js 98.09% <0%> (-1.91%) ⬇️
src/core/components/AMInstallButton/index.js 98.57% <0%> (-1.43%) ⬇️
src/core/middleware/security.js 100% <0%> (ø) ⬆️
src/amo/actions/reviews.js 100% <0%> (ø) ⬆️
src/ui/components/UserReview/index.js 100% <0%> (ø) ⬆️
src/core/installAddon.js 100% <0%> (ø) ⬆️
src/amo/components/AddonReviewListItem/index.js 100% <0%> (ø) ⬆️
src/amo/reducers/reviews.js 100% <0%> (ø) ⬆️
src/core/constants.js 100% <0%> (ø) ⬆️
src/ui/components/Rating/index.js 100% <0%> (ø) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8aff95b...805655f. Read the comment docs.

@willdurand willdurand changed the title Ensure we import "app" SCSS files or "core" for shared files Tidy/simplify SCSS imports Aug 27, 2018
@willdurand willdurand changed the title Tidy/simplify SCSS imports [WIP] Tidy/simplify SCSS imports Aug 27, 2018
@willdurand willdurand changed the title [WIP] Tidy/simplify SCSS imports Tidy/simplify SCSS imports Aug 27, 2018
Copy link
Contributor

@kumar303 kumar303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+wc

Great idea. I love this.

// No "small" breakpoint is defined here because we are mobile-first.
// Instead of adding a rule for only mobile, add a mobile rule and override
// it with `@include respond-to(medium) { [...] }`.
$breakpoints: (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, yeah, this is the right place

@@ -1,5 +1,4 @@
@import '~photon-colors/photon-colors';
@import '~core/css/inc/vars';
@import '~core/css/inc/mixins';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be worth making ~core/css/styles just like the amo one.

@@ -1,10 +1,6 @@
@import '~normalize.css';
Copy link
Contributor

@kumar303 kumar303 Aug 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we need to fix this.

[0] DEPRECATION WARNING on line 1, column 8 of stdin:
[0] Including .css files with @import is non-standard behaviour which will be removed in future versions of LibSass.
Use a custom importer to maintain this behaviour. Check your implementations documentation on how to create a custom importer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, interesting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willdurand
Copy link
Member Author

(builds were green on travis)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify SCSS imports
3 participants