Skip to content

Commit 6868f8f

Browse files
committed
chore: add sass support
See PatrickJS/PatrickJS-starter#136
1 parent 8d97ac3 commit 6868f8f

File tree

5 files changed

+59
-56
lines changed

5 files changed

+59
-56
lines changed

config/webpack.common.js

+7
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ module.exports = {
134134
loader: 'raw-loader'
135135
},
136136

137+
// Sass loader support for *.scss files
138+
{
139+
test: /\.scss$/,
140+
exclude: /node_modules/,
141+
loaders: ['raw-loader', 'sass-loader'] // sass-loader not scss-loader
142+
},
143+
137144
// Raw loader support for *.html
138145
// Returns file content as string
139146
//

package.json

+24-36
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,41 @@
1414
"webpack-dev-server": "webpack-dev-server",
1515
"webdriver-manager": "webdriver-manager",
1616
"protractor": "protractor",
17-
1817
"clean": "npm cache clean && npm run rimraf -- node_modules doc typings coverage dist",
19-
"clean:dist": "npm run rimraf -- dist",
20-
"preclean:install": "npm run clean",
21-
"clean:install": "npm set progress=false && npm install",
22-
"preclean:start": "npm run clean",
23-
"clean:start": "npm start",
24-
18+
"clean:dist": "npm run rimraf -- dist",
19+
"preclean:install": "npm run clean",
20+
"clean:install": "npm set progress=false && npm install",
21+
"preclean:start": "npm run clean",
22+
"clean:start": "npm start",
2523
"watch": "npm run watch:dev",
26-
"watch:dev": "npm run build:dev -- --watch",
27-
"watch:dev:hmr": "npm run watch:dev -- --hot",
28-
"watch:test": "npm run test -- --auto-watch --no-single-run",
29-
"watch:prod": "npm run build:prod -- --watch",
30-
24+
"watch:dev": "npm run build:dev -- --watch",
25+
"watch:dev:hmr": "npm run watch:dev -- --hot",
26+
"watch:test": "npm run test -- --auto-watch --no-single-run",
27+
"watch:prod": "npm run build:prod -- --watch",
3128
"build": "npm run build:dev",
32-
"prebuild:dev": "npm run clean:dist",
33-
"build:dev": "webpack --config config/webpack.dev.js --progress --profile --colors --display-error-details --display-cached",
34-
"prebuild:prod": "npm run clean:dist",
35-
"build:prod": "webpack --config config/webpack.prod.js --progress --profile --colors --display-error-details --display-cached --bail",
36-
29+
"prebuild:dev": "npm run clean:dist",
30+
"build:dev": "webpack --config config/webpack.dev.js --progress --profile --colors --display-error-details --display-cached",
31+
"prebuild:prod": "npm run clean:dist",
32+
"build:prod": "webpack --config config/webpack.prod.js --progress --profile --colors --display-error-details --display-cached --bail",
3733
"server": "npm run server:dev",
38-
"server:dev": "webpack-dev-server --config config/webpack.dev.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base src/",
39-
"server:dev:hmr": "npm run server:dev -- --hot",
40-
"server:prod": "http-server dist --cors",
41-
34+
"server:dev": "webpack-dev-server --config config/webpack.dev.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base src/",
35+
"server:dev:hmr": "npm run server:dev -- --hot",
36+
"server:prod": "http-server dist --cors",
4237
"webdriver:update": "npm run webdriver-manager update",
4338
"webdriver:start": "npm run webdriver-manager start",
44-
4539
"lint": "npm run tslint 'src/**/*.ts'",
46-
47-
"pree2e": "npm run webdriver:update -- --standalone",
40+
"pree2e": "npm run webdriver:update -- --standalone",
4841
"e2e": "npm run protractor",
49-
"e2e:live": "npm run e2e -- --elementExplorer",
50-
42+
"e2e:live": "npm run e2e -- --elementExplorer",
5143
"test": "node --max-old-space-size=4096 node_modules/karma/bin/karma start",
52-
5344
"ci": "npm run e2e && npm run test",
54-
5545
"docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/",
56-
5746
"start": "npm run server:dev",
58-
"start:hmr": "npm run server:dev:hmr",
59-
47+
"start:hmr": "npm run server:dev:hmr",
6048
"postinstall": "npm run typings -- install",
61-
62-
"preversion": "npm test",
49+
"preversion": "npm test",
6350
"version": "npm run build",
64-
"postversion": "git push && git push --tags"
65-
51+
"postversion": "git push && git push --tags"
6652
},
6753
"dependencies": {
6854
"@angular2-material/button": "^2.0.0-alpha.1",
@@ -81,6 +67,7 @@
8167
"devDependencies": {
8268
"angular2-hmr": "~0.5.5",
8369
"awesome-typescript-loader": "~0.16.2",
70+
"codelyzer": "0.0.12",
8471
"compression-webpack-plugin": "^0.3.0",
8572
"copy-webpack-plugin": "^1.1.1",
8673
"css-loader": "^0.23.1",
@@ -104,14 +91,15 @@
10491
"karma-phantomjs-launcher": "^1.0.0",
10592
"karma-sourcemap-loader": "^0.3.7",
10693
"karma-webpack": "1.7.0",
107-
"codelyzer": "0.0.12",
94+
"node-sass": "^3.4.2",
10895
"parse5": "^1.3.2",
10996
"phantomjs-polyfill": "0.0.2",
11097
"phantomjs-prebuilt": "^2.1.6",
11198
"protractor": "^3.1.1",
11299
"raw-loader": "0.5.1",
113100
"remap-istanbul": "^0.5.1",
114101
"rimraf": "^2.5.2",
102+
"sass-loader": "^3.2.0",
115103
"source-map-loader": "^0.1.5",
116104
"style-loader": "^0.13.0",
117105
"ts-helper": "0.0.1",

src/app/app.component.ts

+5-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Angular 2 decorators and services
33
*/
4-
import {Component} from 'angular2/core';
4+
import {Component, ViewEncapsulation} from 'angular2/core';
55
import {RouteConfig, Router} from 'angular2/router';
66

77
import {Home} from './home';
@@ -17,24 +17,10 @@ import {RouterActive} from './router-active';
1717
pipes: [ ],
1818
providers: [ ],
1919
directives: [ RouterActive ],
20-
styles: [`
21-
h1 {
22-
font-family: Arial, Helvetica, sans-serif
23-
}
24-
nav ul {
25-
display: inline;
26-
list-style-type: none;
27-
margin: 0;
28-
padding: 0;
29-
width: 60px;
30-
}
31-
nav li {
32-
display: inline;
33-
}
34-
nav li.active {
35-
background-color: lightgray;
36-
}
37-
`],
20+
styles: [
21+
require('./app.scss')
22+
],
23+
encapsulation: ViewEncapsulation.None,
3824
template: `
3925
<header>
4026
<nav>

src/app/app.scss

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
$background: tomato;
2+
3+
html {
4+
background-color: $background;
5+
}
6+
7+
h1 {
8+
font-family: Arial, Helvetica, sans-serif
9+
}
10+
nav ul {
11+
display: inline;
12+
list-style-type: none;
13+
margin: 0;
14+
padding: 0;
15+
width: 60px;
16+
}
17+
nav li {
18+
display: inline;
19+
}
20+
nav li.active {
21+
background-color: lightgray;
22+
}

src/vendor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import 'rxjs/add/operator/mergeMap';
2323
// import '@angular2-material/checkbox';
2424
// import '@angular2-material/radio';
2525
// import '@angular2-material/progress-circle';
26-
// import '@angular2-material/card';
26+
import '@angular2-material/card';
2727
// look in platform/directives and platform/providers
2828

2929
if ('production' === ENV) {

0 commit comments

Comments
 (0)