diff --git a/README.md b/README.md
index 0eb18de..0c74b7a 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,10 @@
-# An opinionated Angular 2 + Webpack boilerplate
+# An Angular 2 + Webpack boilerplate with examples
-**Work in progress.** This kit is not created for learning purposes, but rather as a base for my own upcoming projects. I'm not sure that world needs _yet another_ Angular 2 + webpack boilerplate, but initially it was shared as a solution for [TypeScript code coverage issue](https://github.com/AngularClass/angular2-webpack-starter/issues/178).
+Angular 2 application with some examples (currently only HTTP service and component). Please, feel free to create issues and PRs.
-Feel free to create issues and PRs, though, if you know how to do this thing better.
+Templates and stylesheets are embedded into JS bundle with help of [angular2-template-loader](https://github.com/TheLarkInn/angular2-template-loader). SASS/SCSS is used for styling.
-### What's inside
-
-Angular 2 example application (examples for components, HTTP, forms, routing are yet to come - most likely when Angular 2 is out of RC state).
-
-Templates and stylesheets are embedded into JS bundle. I chose SASS for styling.
-
-`index.html` is generated using [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin). Some popular analytics/metrics are yet to be added there (e.g. Google Analytics or New Relic).
+`index.html` is generated using [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin).
Hot module replacement is not provided here. Possibly I'll add it later. Same goes for service workers.
@@ -30,14 +24,30 @@ You won't find end-to-end tests in this project (usually people use Protractor f
### Building bundle(s)
-Use `npm run build` and you will get JS bundles, their maps and `index.html` in `dist` directory. To build for production, use `NODE_ENV=production npm run build` (webpack configuration is chosen according to this environment variable).
+Use `npm run build` and you will get JS bundles, their maps and `index.html` in `dist` directory.
+
+To build for production, use `NODE_ENV=production npm run build` (webpack configuration is chosen according to this environment variable).
### Documentation
-Run `npm run docs` to generate documentation for TypeScript ([typedoc](https://github.com/TypeStrong/typedoc) is used for that) and SASS stylesheets (done with [kss-node](https://github.com/kss-node/kss-node)). This might seem a little bit unusual to have docs for styles, but I find KSS very nice tool to keep them understandable.
+Run `npm run docs` to generate documentation for TypeScript ([typedoc](https://github.com/TypeStrong/typedoc) is used for that) and SASS stylesheets (done with [kss-node](https://github.com/kss-node/kss-node)).
+
+### Dev notes
+
+- Webpack is configured to resolve modules not only from `node_modules` directory, but also from `src`. This is done to keep imports simple and avoid situations like `import { MyService } from '../../../app.service'`. Especially important for tests, since they are in a separate directory. If you are using JetBrains IDE, mark `src` directory as resource root
+
+- Upgrade to newer version of `istanbul-instrumenter-loader` (`0.2.0` to `1.0.0`) breaks code coverage
+
+- Upgrade to `awesome-typescript-loader@2.*.*` is not possible, as it is targeted to work with webpack 2, which is yet in beta and I don't want to use it until it's released
-### Notes for development
+## TODOs
-Modules are resolved not only from `node_modules` directory, but from `src` as well. This is done to keep imports simple and avoid situations like `import { MyService } from '../../../app.service'`.
+- Examples
+ - Typeahead with throttle/distinct
+ - Pipe
+ - AuthGuard in router
+ - Forms
+ - Input and Output
+ - rxjs-based WebSocket
-If you are using JetBrains IDE, mark `src` directory as resource root.
+- Comments on tests
diff --git a/package.json b/package.json
index 4d3d2e3..b68a5c6 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"angular2",
"webpack",
"typescript",
+ "rxjs",
"boilerplate",
"starter"
],
@@ -27,6 +28,7 @@
"coverage:remap": "remap-istanbul -i coverage/coverage.json -o coverage/coverage.json -t json -e node_modules,tests,karma.entry.ts",
"coverage:report": "istanbul report",
"build": "webpack",
+ "preinstall": "npm run clean",
"postinstall": "typings install",
"docs": "npm run docs:typedoc && npm run docs:kss",
"docs:typedoc": "typedoc --options ./typedoc.json ./src/app",
@@ -34,55 +36,55 @@
"start": "webpack-dev-server --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base ./dist"
},
"devDependencies": {
- "@angular/common": "2.0.0",
- "@angular/compiler": "2.0.0",
- "@angular/core": "2.0.0",
- "@angular/forms": "2.0.0",
- "@angular/http": "2.0.0",
- "@angular/platform-browser": "2.0.0",
- "@angular/platform-browser-dynamic": "2.0.0",
- "@angular/router": "3.0.0",
- "awesome-typescript-loader": "^1.1.1",
- "codelyzer": "^0.0.26",
- "core-js": "^2.4.1",
- "css-loader": "^0.23.1",
- "es6-shim": "^0.35.1",
- "file-loader": "^0.8.5",
- "html-loader": "^0.4.3",
- "html-webpack-plugin": "^2.22.0",
- "istanbul-instrumenter-loader": "^0.2.0",
- "jasmine-core": "^2.4.1",
- "json-loader": "^0.5.4",
- "karma": "^0.13.22",
- "karma-coverage": "^1.1.1",
- "karma-jasmine": "^1.0.2",
- "karma-mocha-reporter": "^2.0.5",
- "karma-phantomjs-launcher": "^1.0.1",
- "karma-source-map-support": "^1.1.0",
- "karma-sourcemap-loader": "^0.3.7",
- "karma-webpack": "^1.7.0",
- "kss": "^3.0.0-beta.14",
- "node-sass": "^3.8.0",
- "phantomjs-prebuilt": "^2.1.8",
- "raw-loader": "^0.5.1",
- "reflect-metadata": "^0.1.3",
- "remap-istanbul": "^0.6.4",
- "rimraf": "^2.5.2",
+ "@angular/common": "2.1.2",
+ "@angular/compiler": "2.1.2",
+ "@angular/core": "2.1.2",
+ "@angular/forms": "2.1.2",
+ "@angular/http": "2.1.2",
+ "@angular/platform-browser": "2.1.2",
+ "@angular/platform-browser-dynamic": "2.1.2",
+ "@angular/router": "3.1.2",
+ "angular-in-memory-web-api": "^0.1.14",
+ "angular2-template-loader": "0.6.0",
+ "awesome-typescript-loader": "1.1.1",
+ "codelyzer": "0.0.26",
+ "core-js": "2.4.1",
+ "es6-shim": "0.35.1",
+ "flexboxgrid-sass": "8.0.5",
+ "html-loader": "0.4.4",
+ "html-webpack-plugin": "2.24.1",
+ "istanbul-instrumenter-loader": "0.2.0",
+ "jasmine-core": "2.5.2",
+ "json-loader": "0.5.4",
+ "karma": "1.3.0",
+ "karma-coverage": "1.1.1",
+ "karma-jasmine": "1.0.2",
+ "karma-mocha-reporter": "2.2.0",
+ "karma-phantomjs-launcher": "1.0.2",
+ "karma-source-map-support": "1.2.0",
+ "karma-sourcemap-loader": "0.3.7",
+ "karma-webpack": "1.8.0",
+ "kss": "3.0.0-beta.16",
+ "node-sass": "3.11.2",
+ "normalize-scss": "6.0.0",
+ "phantomjs-prebuilt": "2.1.13",
+ "raw-loader": "0.5.1",
+ "reflect-metadata": "0.1.8",
+ "remap-istanbul": "0.7.0",
+ "rimraf": "2.5.4",
"rxjs": "5.0.0-beta.12",
- "sass-lint": "^1.8.2",
- "sass-loader": "^3.2.3",
- "source-map-loader": "^0.1.5",
- "style-loader": "^0.13.1",
- "to-string-loader": "^1.1.4",
- "ts-helpers": "^1.1.1",
- "tslint": "^3.14.0",
- "tslint-loader": "^2.1.5",
- "typedoc": "^0.4.4",
- "typescript": "^2.0.2",
- "typings": "^1.3.2",
- "webpack": "^1.13.1",
- "webpack-dev-server": "^1.14.1",
+ "sass-lint": "1.10.2",
+ "sass-loader": "4.0.2",
+ "skeleton-scss": "2.0.4",
+ "source-map-loader": "0.1.5",
+ "ts-helpers": "1.1.2",
+ "tslint": "3.15.1",
+ "typedoc": "0.5.1",
+ "typescript": "2.0.8",
+ "typings": "1.3.2",
+ "webpack": "1.13.3",
+ "webpack-dev-server": "1.16.2",
"webpack-md5-hash": "0.0.5",
- "zone.js": "^0.6.23"
+ "zone.js": "0.6.26"
}
}
diff --git a/src/app/_variables.scss b/src/app/_variables.scss
new file mode 100644
index 0000000..c44f46f
--- /dev/null
+++ b/src/app/_variables.scss
@@ -0,0 +1,2 @@
+$heading-color: #333;
+$heading-highlight-color: #fa2800;
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 3a11545..75ea701 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,19 +1,14 @@
import { Component, ViewEncapsulation } from '@angular/core';
-import { AppService } from './app.service';
+/**
+ * Styles required here are common for all components (SASS/SCSS versions of normalize.css and flexboxgrid),
+ * so encapsulation is not used. Other components have their styles scoped with `ViewEncapsulation.Emulated`.
+ */
@Component({
selector: 'da-app',
- template: require('./app.html'),
- styles: [
- require('./app.scss')
- ],
- encapsulation: ViewEncapsulation.Native,
- providers: [
- AppService
- ]
+ templateUrl: './app.html',
+ styleUrls: ['./app.scss'],
+ encapsulation: ViewEncapsulation.None,
+ providers: []
})
-export class AppComponent {
- constructor(public appService: AppService) {
-
- }
-}
+export class AppComponent {}
diff --git a/src/app/app.html b/src/app/app.html
index 4658077..3acd108 100644
--- a/src/app/app.html
+++ b/src/app/app.html
@@ -1 +1,17 @@
-