-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enable sass compiling in webpack for chrome styles #107
Conversation
camilamercado
commented
Apr 25, 2018
- Converts chrome styles index.sss to index.scss
- Adds sass-loader to webpack development and production files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggesting a little bit of clean up here :)
packages/b-ber-reader/src/index.scss
Outdated
} | ||
} | ||
|
||
@keyframes spin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this valid SCSS?
packages/b-ber-reader/src/index.scss
Outdated
border-bottom: 1px solid $black; | ||
height: $component-x; | ||
|
||
& nav ul { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ampersands that aren't joining declarations aren't necessary, and sort of confusing I think in SCSS if they're not needed. Might be good to get rid of them
exclude: /(node_modules|public|dist|test)/, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: 'style-loader', | ||
use: [ | ||
{loader: 'css-loader'}, | ||
{loader: 'postcss-loader'}, | ||
{loader: 'css-loader', options: {minimize: true}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need to minify in dev. Also that space before the first curly is freaking me out 😱
packages/b-ber-reader/package.json
Outdated
@@ -47,12 +47,14 @@ | |||
"file-loader": "^1.1.11", | |||
"html-webpack-plugin": "^3.0.6", | |||
"jest": "^22.4.3", | |||
"node-sass": "^4.8.3", | |||
"nodemon": "^1.17.1", | |||
"postcss": "^6.0.19", | |||
"postcss-cssnext": "^3.1.0", | |||
"postcss-import": "^11.1.0", | |||
"postcss-loader": "^2.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like node-sass was removed as a peerDependency?
https://github.com/webpack-contrib/sass-loader/pull/533/files
see last comment on this issue: webpack-contrib/sass-loader#532
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to postcss-loader
on line 55.
Would be good to check all the postcss
stuff, too, since I think we're only using autoprefixer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msimmer yeah the postcss
dependencies aren't necessary. There are a handful of other node modules that aren't being used. Although I'm not sure if you have plans to implement some of these in the future. Also note that depcheck has a persistent issue evaluating webpack and babel deps (despite use of special flags).
camilas-MBP-2:b-ber-reader camila$ depcheck --specials=babel,webpack,eslint
Unused dependencies
* babel-polyfill
* material-design-icons
Unused devDependencies
* babel-cli
* babel-core
* babel-loader
* babel-preset-stage-0
* concurrently
* css-loader
* eslint-config-airbnb-base
* file-loader
* jest
* node-sass
* nodemon
* postcss
* postcss-cssnext
* postcss-import
* postcss-loader
* rimraf
* sass-loader
* style-loader
* sugarss
* url-loader
* webpack-cleanup-plugin
* webpack-cli
* webpack-dashboard
* webpack-node-externals
FTM im just going to remove
* postcss
* postcss-cssnext
* postcss-import
* postcss-loader
...
* sugarss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah the postcss dependencies aren't necessary
Are you sure none of them are necessary? I'm fairly certain that Autoprefixer is bundled in postcss
, which is being used (I think! If not then it should be).
There are a handful of other node modules that aren't being used
Did you look at that list of modules? node-sass
is on it ...
Also note that depcheck has a persistent issue evaluating webpack and babel deps (despite use of special flags).
Then why use it?
packages/b-ber-reader/package.json
Outdated
"nodemon": "^1.17.1", | ||
"postcss": "^6.0.19", | ||
"postcss-cssnext": "^3.1.0", | ||
"postcss-import": "^11.1.0", | ||
"postcss-loader": "^2.1.1", | ||
"rimraf": "^2.6.2", | ||
"sass-loader": "^7.0.1", | ||
"style-loader": "^0.20.2", | ||
"sugarss": "^1.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This we don't need
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, this refers to line 59 (sugarss
). I'm adding comments here at the specific line they relate to
packages/b-ber-reader/src/index.sss
Outdated
@@ -209,4 +209,3 @@ button | |||
border-left-color: var(--black) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is index.sss
still in the package? Can be removed if so
{loader: 'css-loader'}, | ||
{loader: 'postcss-loader'}, | ||
{loader: 'css-loader', options: {minimize: true}}, | ||
{loader: 'sass-loader'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, I know this sounds totally neurotic, but would be great to have a dangling comma there ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dangling comma where?
like so? {loader: 'sass-loader'},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{loader: 'css-loader'}, | ||
{loader: 'postcss-loader'}, | ||
{loader: 'css-loader', options: {minimize: true}}, | ||
{loader: 'sass-loader'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same re: comma.
@msimmer thanks- have to run now, will revisit later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nitpicking
"access": "public" | ||
}, | ||
"scripts": { | ||
"start": "sass -l --trace --watch application.scss:demo/application.css" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to be running this with node-sass
instead
|
||
|
||
&.figure__small--portrait-high, // new class names | ||
&.portraitLong // legacy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get rid of the legacy stuff I think
@import 'base/table'; | ||
@import 'base/text'; | ||
@import 'base/web'; // conditional styles | ||
@import 'base/print'; // for print views and PDF generation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I added a PR in the GitLab repo with Reader styles, looks like it got merged in, but don't see the import here? Not sure if you were planning on including those styles here yet, if not then ignore this
|
||
@if $build == 'web' { | ||
.publication__contents { | ||
font-size: 80%; // 20px |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are those tabs?
$grey: #eee !default; | ||
$dimgrey: #696969 !default; | ||
$info: #26A4B7 !default; | ||
$warning: #DA4539 !default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs!
$info: #26A4B7 !default; | ||
$warning: #DA4539 !default; | ||
$danger: #CD8D59 !default; | ||
$success: #5050C5 !default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's def a tab
packages/b-ber-reader/src/index.scss
Outdated
} | ||
|
||
.material-icons { | ||
font-family: 'Material Icons'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msimmer Doing a cleanup of SCSS now with linter. Frequent error arising for Property Sort Order
PropertySortOrder: Properties should be ordered direction
Should I follow this protocol order properties alphabetically?
It seems a little counter intuitive to separate properties such as
-webkit-font-smoothing: antialiased;
and -moz-osx-font-smoothing: grayscale;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't set up SCSS linting WRT to style, I'm only using it to detect critical errors. If you'd like to make one up, maybe easiest is to use the current conventions as a base, and then just make up a config file where everything that's in there passes with the current SCSS.
packages/b-ber-reader/src/index.scss
Outdated
} | ||
& li, & dt { | ||
padding: calc(#{$component-x} / 2) 0 0 calc(#{$component-x} / 2); | ||
& a { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msimmer additionally- frequent errors on SelectorDepth rule.
SelectorDepth: Selector should have depth of applicability no greater than 3, but was 4
10+ instances of this error, with selectorDepth
ranging from 4-5.
Should I adapt the SCSS to stick to the default depth (3)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see above response. The initial note was just about readability of the SCSS WRT ampersands, so if that's fixed then I'm happy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msimmer unless i missed something it looks like all of the other reviews are now outdated?
require('cssnano')(), | ||
] | ||
} | ||
}, | ||
{loader: 'sass-loader'}, | ||
], | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msimmer just tested this config, which is now outputting minified css w vendor prefixes and functioning in the bowser/reader.
postcss
was initially throwing syntax errors when used w sass-loader
, getting caught up on Unnecessary curly bracket
and Unnecessary semicolon
when building the index.scss file. Specifying the autoprefixer
and cssnano
plugins resolved these errs.
Hey @camilamercado, can you please just squash all these changes along with the previous PR and resubmit? It's getting difficult to tell what the current state of things is right now :/ |
…webpack for sass build
d47de14
to
a31c48c
Compare