docs(webpack): one step closer to CLI (#3283)

* docs(webpack): one step closer to CLI

* add html reporter
This commit is contained in:
Jesús Rodríguez 2017-02-23 13:26:27 +01:00 committed by GitHub
parent 6d1716eaa6
commit 2c7a7d4fbc
11 changed files with 36 additions and 29 deletions

View File

@ -42,7 +42,7 @@
"@types/node": "^6.0.45", "@types/node": "^6.0.45",
"angular-cli": "^1.0.0-beta.26", "angular-cli": "^1.0.0-beta.26",
"angular2-template-loader": "^0.6.0", "angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^3.0.0-beta.18", "awesome-typescript-loader": "^3.0.4",
"babel-cli": "^6.16.0", "babel-cli": "^6.16.0",
"babel-preset-angular2": "^0.0.2", "babel-preset-angular2": "^0.0.2",
"babel-preset-es2015": "^6.16.0", "babel-preset-es2015": "^6.16.0",
@ -80,9 +80,9 @@
"ts-node": "^1.3.0", "ts-node": "^1.3.0",
"tslint": "^3.15.1", "tslint": "^3.15.1",
"typescript": "~2.0.10", "typescript": "~2.0.10",
"webpack": "2.2.0", "webpack": "2.2.1",
"webpack-dev-server": "2.2.0-rc.0", "webpack-dev-server": "2.4.1",
"webpack-merge": "^2.4.0" "webpack-merge": "^3.0.0"
}, },
"repository": {} "repository": {}
} }

View File

@ -25,12 +25,12 @@ module.exports = function (config) {
noInfo: true noInfo: true
}, },
reporters: ['progress'], reporters: ['kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
autoWatch: false, autoWatch: false,
browsers: ['PhantomJS'], browsers: ['Chrome'],
singleRun: true singleRun: true
}; };

View File

@ -24,10 +24,12 @@ module.exports = {
rules: [ rules: [
{ {
test: /\.ts$/, test: /\.ts$/,
loaders: [{ loaders: [
{
loader: 'awesome-typescript-loader', loader: 'awesome-typescript-loader',
options: { configFileName: helpers.root('src', 'tsconfig.json') } options: { configFileName: helpers.root('src', 'tsconfig.json') }
} , 'angular2-template-loader'] } , 'angular2-template-loader'
]
}, },
{ {
test: /\.html$/, test: /\.html$/,

View File

@ -13,7 +13,12 @@ module.exports = {
rules: [ rules: [
{ {
test: /\.ts$/, test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader'] loaders: [
{
loader: 'awesome-typescript-loader',
options: { configFileName: helpers.root('src', 'tsconfig.json') }
} , 'angular2-template-loader'
]
}, },
{ {
test: /\.html$/, test: /\.html$/,

View File

@ -23,9 +23,9 @@
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^6.0.45", "@types/node": "^6.0.45",
"@types/jasmine": "^2.5.35", "@types/jasmine": "2.5.36",
"angular2-template-loader": "^0.6.0", "angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^3.0.0-beta.18", "awesome-typescript-loader": "^3.0.4",
"css-loader": "^0.26.1", "css-loader": "^0.26.1",
"extract-text-webpack-plugin": "2.0.0-beta.5", "extract-text-webpack-plugin": "2.0.0-beta.5",
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
@ -33,18 +33,17 @@
"html-webpack-plugin": "^2.16.1", "html-webpack-plugin": "^2.16.1",
"jasmine-core": "^2.4.1", "jasmine-core": "^2.4.1",
"karma": "^1.2.0", "karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.0.2", "karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.1", "karma-webpack": "^2.0.1",
"null-loader": "^0.1.1", "null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.7",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"rimraf": "^2.5.2", "rimraf": "^2.5.2",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"typescript": "~2.0.10", "typescript": "~2.0.10",
"webpack": "2.2.0", "webpack": "2.2.1",
"webpack-dev-server": "2.2.0-rc.0", "webpack-dev-server": "2.4.1",
"webpack-merge": "^2.4.0" "webpack-merge": "^3.0.0"
} }
} }

View File

@ -2,6 +2,6 @@
<main> <main>
<h1>Hello from Angular App with Webpack</h1> <h1>Hello from Angular App with Webpack</h1>
<img src="../../public/images/angular.png"> <img src="../assets/images/angular.png">
</main> </main>
<!-- #enddocregion --> <!-- #enddocregion -->

View File

@ -1,7 +1,7 @@
// #docregion // #docregion
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import '../../public/css/styles.css'; import '../assets/css/styles.css';
@Component({ @Component({
selector: 'my-app', selector: 'my-app',

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -152,17 +152,17 @@ code-example(language="sh" class="code-shell").
cd angular-webpack cd angular-webpack
:marked :marked
Add these files to the root directory: Add these files:
+makeTabs( +makeTabs(
`webpack/ts/package.webpack.json, `webpack/ts/package.webpack.json,
webpack/ts/tsconfig.1.json, webpack/ts/src/tsconfig.1.json,
webpack/ts/webpack.config.js, webpack/ts/webpack.config.js,
webpack/ts/karma.webpack.conf.js, webpack/ts/karma.webpack.conf.js,
webpack/ts/config/helpers.js`, webpack/ts/config/helpers.js`,
null, null,
`package.json, `package.json,
tsconfig.json, src/tsconfig.json,
webpack.config.js, webpack.config.js,
karma.conf.js, karma.conf.js,
config/helpers.js` config/helpers.js`
@ -276,9 +276,9 @@ a#common-rules
* css - The pattern matches application-wide styles; the second handles component-scoped styles (the ones specified in a component's `styleUrls` metadata property) * css - The pattern matches application-wide styles; the second handles component-scoped styles (the ones specified in a component's `styleUrls` metadata property)
.l-sub-section .l-sub-section
:marked :marked
The first pattern excludes `.css` files within the `/src/app` directories where the component-scoped styles sit. The first pattern is for the application-wide styles. It excludes `.css` files within the `src/app` directory
It includes only `.css` files located at or above `/src`; these are the application-wide styles. where the component-scoped styles sit. The `ExtractTextPlugin` (described below) applies the `style` and `css`
The `ExtractTextPlugin` (described below) applies the `style` and `css` loaders to these files. loaders to these files.
The second pattern filters for component-scoped styles and loads them as strings via the `raw` loader &mdash; The second pattern filters for component-scoped styles and loads them as strings via the `raw` loader &mdash;
which is what Angular expects to do with styles specified in a `styleUrls` metadata property. which is what Angular expects to do with styles specified in a `styleUrls` metadata property.
@ -446,11 +446,11 @@ code-example(language="sh" class="code-shell").
+makeTabs( +makeTabs(
`webpack/ts/src/index.html, `webpack/ts/src/index.html,
webpack/ts/src/main.ts, webpack/ts/src/main.ts,
webpack/ts/public/css/styles.css`, webpack/ts/src/assets/css/styles.css`,
null, null,
`src/index.html, `src/index.html,
src/main.ts, src/main.ts,
public/css/styles.css` src/assets/css/styles.css`
) )
+makeTabs( +makeTabs(
@ -468,10 +468,11 @@ code-example(language="sh" class="code-shell").
) )
p. :marked
The <code>app.component.html</code> displays this downloadable Angular logo The <code>app.component.html</code> displays this downloadable Angular logo
<a href="https://raw.githubusercontent.com/angular/angular.io/master/public/resources/images/logos/angular2/angular.png" target="_blank"> <a href="https://raw.githubusercontent.com/angular/angular.io/master/public/resources/images/logos/angular2/angular.png" target="_blank">
<img src="/resources/images/logos/angular2/angular.png" height="40px" title="download Angular logo"></a>. <img src="/resources/images/logos/angular2/angular.png" height="40px" title="download Angular logo"></a>.
Create folder `images` under the project's "assets" folder, then right-click and download the image to that folder.
a#bundle-ts a#bundle-ts
:marked :marked