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

Add scss for components in angular apps by default. #2703

Merged
merged 5 commits into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions app/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"json5": "^0.5.1",
"lodash.pick": "^4.4.0",
"markdown-loader": "^2.0.2",
"node-sass": "^4.7.2",
"postcss-flexbugs-fixes": "^3.0.0",
"postcss-loader": "^2.0.10",
"prop-types": "^15.5.10",
Expand All @@ -70,6 +71,7 @@
"redux": "^3.6.0",
"request": "^2.81.0",
"rxjs": "^5.4.2",
"sass-loader": "^6.0.6",
"serve-favicon": "^2.4.3",
"shelljs": "^0.7.8",
"style-loader": "^0.18.2",
Expand Down
8 changes: 6 additions & 2 deletions app/angular/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ export default function(configDir) {
loaders: [require.resolve('ts-loader'), require.resolve('angular2-template-loader')],
},
{
test: /\.(html|css)$/,
test: /\.html$/,
loader: 'raw-loader',
exclude: /\.async\.(html|css)$/,
exclude: /\.async\.css$/,
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to exclude a css file is it doesn't pass the test anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, I think I need to exclude html here.

},
{
test: /\.scss$/,
loaders: [require.resolve('raw-loader'), require.resolve('sass-loader')],
},
{
test: /\.md$/,
Expand Down
6 changes: 5 additions & 1 deletion app/angular/src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ export default function(configDir) {
loaders: [require.resolve('ts-loader'), require.resolve('angular2-template-loader')],
},
{
test: /\.(html|css)$/,
test: /\.html$/,
loader: 'raw-loader',
exclude: /\.async\.(html|css)$/,
},
{
test: /\.scss$/,
loaders: [require.resolve('raw-loader'), require.resolve('sass-loader')],
},
],
},
resolve: {
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions examples/angular-cli/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<!--The content below is only a placeholder and can be replaced.-->
<div class="hide" style="color: red; font-size: 30px; text-align: center;">
This should be hidden, if not - scss is not loaded as needed.
</div>
<div style="text-align:center">
<h1>
Welcome to {{title}}!
Expand Down
5 changes: 5 additions & 0 deletions examples/angular-cli/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$display: none;

.hide {
display: $display;
}
2 changes: 1 addition & 1 deletion examples/angular-cli/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'storybook-app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
title = 'app';
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9849,7 +9849,7 @@ node-pre-gyp@^0.6.36, node-pre-gyp@^0.6.39:
tar "^2.2.1"
tar-pack "^3.4.0"

node-sass@^4.3.0:
node-sass@^4.3.0, node-sass@^4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.7.2.tgz#9366778ba1469eb01438a9e8592f4262bcb6794e"
dependencies:
Expand Down Expand Up @@ -12795,7 +12795,7 @@ sass-graph@^2.2.4:
scss-tokenizer "^0.2.3"
yargs "^7.0.0"

sass-loader@^6.0.3:
sass-loader@^6.0.3, sass-loader@^6.0.6:
version "6.0.6"
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-6.0.6.tgz#e9d5e6c1f155faa32a4b26d7a9b7107c225e40f9"
dependencies:
Expand Down