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

Enable sass compiling in webpack for chrome styles #107

Closed
wants to merge 4 commits into from

Conversation

camilamercado
Copy link
Contributor

Copy link
Member

@msimmer msimmer left a 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 :)

}
}

@keyframes spin {
Copy link
Member

Choose a reason for hiding this comment

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

Is this valid SCSS?

border-bottom: 1px solid $black;
height: $component-x;

& nav ul {
Copy link
Member

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}},
Copy link
Member

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 😱

@@ -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",
Copy link
Member

Choose a reason for hiding this comment

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

We still need this?

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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?

"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",
Copy link
Member

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

Copy link
Member

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

@@ -209,4 +209,3 @@ button
border-left-color: var(--black)
Copy link
Member

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'}
Copy link
Member

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 ...

Copy link
Contributor Author

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'},

Copy link
Member

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'}
Copy link
Member

Choose a reason for hiding this comment

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

Same re: comma.

@camilamercado
Copy link
Contributor Author

@msimmer thanks- have to run now, will revisit later

Copy link
Member

@msimmer msimmer left a 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"
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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

@camilamercado
Copy link
Contributor Author

camilamercado commented Apr 26, 2018

@msimmer addressed comments on webpack files and index.sss in commit 567c2512. Will revisit scss and dependencies when I have more time (later this week).

}

.material-icons {
font-family: 'Material Icons';
Copy link
Contributor Author

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;

Copy link
Member

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.

}
& li, & dt {
padding: calc(#{$component-x} / 2) 0 0 calc(#{$component-x} / 2);
& a {
Copy link
Contributor Author

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)?

Copy link
Member

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@msimmer yes this is fixed- ampersands removed and tabs converted to spaces with commit ae01c95

Copy link
Contributor Author

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'},
],
}),
Copy link
Contributor Author

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.

@msimmer
Copy link
Member

msimmer commented May 8, 2018

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 :/

@msimmer msimmer closed this Jun 13, 2018
@camilamercado camilamercado deleted the reader-styles-dev branch November 8, 2018 20:22
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.

2 participants