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

Demo Sass capabilities in with-next-sass example #11674

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/with-next-sass/components/hello-world.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
@use '@material/typography';
Copy link
Member

Choose a reason for hiding this comment

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

The includePaths option is not needed if you prefix it with ~ right 🤔

Suggested change
@use '@material/typography';
@use '~@material/typography';

That opts in the file for module resolution through webpack

Copy link
Contributor Author

@nicholaschiang nicholaschiang Apr 6, 2020

Choose a reason for hiding this comment

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

Nope, because the Sass modules that I'm using have their own imports (that do not use the ~ in their @use statements).

I don't want to mess with my dependencies's source code.

Copy link
Member

Choose a reason for hiding this comment

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

Seems like those modules are not working in the general ecosystem overall then?


$color: red;

.hello {
color: $color;
@include typography.typography('headline4');
}
11 changes: 11 additions & 0 deletions examples/with-next-sass/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path');

module.exports = {
experimental: {
sassOptions: {
includePaths: [
path.resolve(__dirname, 'node_modules'),
],
},
},
};
1 change: 1 addition & 0 deletions examples/with-next-sass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"start": "next start"
},
"dependencies": {
"@material/typography": "^5.1.0",
"next": "latest",
"react": "^16.7.0",
"react-dom": "^16.7.0",
Expand Down
3 changes: 3 additions & 0 deletions examples/with-next-sass/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import HelloWorld from '../components/hello-world'

export default () => (
<div className="app">
<div className="mdc-typography mdc-typography--headline1">
This is a headline1.
</div>
<HelloWorld />
</div>
)
2 changes: 2 additions & 0 deletions examples/with-next-sass/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '@material/typography/mdc-typography';

$backgroundColor: #2ecc71;

.app {
Expand Down