├── .gitignore ├── LICENSE ├── README.md ├── agnular-gulp-starter.sln ├── angular-gulp-starter.csproj ├── angular-gulp-starter.csproj.user ├── app ├── app-routing.module.ts ├── app.component.scss ├── app.component.ts ├── app.module.ts ├── dashboard │ ├── dashboard-exports.ts │ ├── dashboard-imports.ts │ ├── dashboard-routing.module.ts │ ├── dashboard.component │ │ ├── dashboard.component.html │ │ ├── dashboard.component.scss │ │ └── dashboard.component.ts │ └── dashboard.module.ts ├── heroes │ ├── hero-detail.component │ │ ├── hero-detail.component.html │ │ ├── hero-detail.component.scss │ │ └── hero-detail.component.ts │ ├── hero-search.component │ │ ├── hero-search.component.html │ │ ├── hero-search.component.scss │ │ ├── hero-search.component.ts │ │ └── hero-search.service.ts │ ├── heroes-exports.ts │ ├── heroes-imports.ts │ ├── heroes-routing.module.ts │ ├── heroes.component │ │ ├── heroes.component.html │ │ ├── heroes.component.scss │ │ └── heroes.component.ts │ ├── heroes.module.ts │ └── services │ │ ├── hero.service.ts │ │ └── mock-heroes.ts ├── main-aot.ts ├── main.ts ├── models │ ├── hero.ts │ └── models-exports.ts └── rxjs-extensions.ts ├── assets ├── gif-load.gif ├── global.css ├── global.min.css └── global.scss ├── build-tools ├── build-scripts │ ├── bundling.js │ ├── compilation.js │ └── path-tools.js ├── express-http-server.dev.js ├── express-http-server.prod.js ├── rollup-config.js ├── systemjs-config.js ├── tsconfig.rxjs-to-es6.json └── variables.js ├── build.common.js ├── build.dev.js ├── build.prod.js ├── compilerconfig.json ├── compilerconfig.json.defaults ├── gulpfile.js ├── index.html ├── package.json ├── tsconfig.json ├── tsconfig.ngc.json └── tsconfig.prod.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist-dev 3 | temp 4 | app-aot 5 | app/**/*.js 6 | app/**/*.js.map 7 | app/**/*.css 8 | app/**/*.metadata.json 9 | npm-debug.log 10 | typings 11 | obj 12 | bin 13 | dist 14 | .vs 15 | rxjs-es -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 PFight 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular gulp starter 2 | Simple dev/prod gulp build for Angular (2+) using systemjs, rollup, ngc (AOT), scss, and with dev/prod servers via express. 3 | 4 | ### Setup 5 | 6 | npm install gulp -g 7 | npm install 8 | 9 | ### See in action 10 | 11 | [Try DEV build online](https://pfight.github.io/angular-gulp-starter-online-dev/) 12 | 13 | [Try PROD build online](https://pfight.github.io/angular-gulp-starter-online-prod) 14 | 15 | ### Commands 16 | 17 | ##### Development buid 18 | 19 | gulp build-dev --color 20 | 21 | Development build includes compilation of SCSS and TypeScript, and bundling of rxjs to single file. 22 | 23 | ##### Production build 24 | 25 | gulp build-prod --color 26 | 27 | Production build includes compilation of SCSS, AOT compilation and tree-shaking with Rollup. All result files moved to `dist` dir. Production build output do not conflicts with development. 28 | 29 | ##### Start develoment server 30 | 31 | npm start 32 | 33 | Server will be listening on [http://localhost:8181](http://localhost:8181). 34 | 35 | ##### Start production test server 36 | 37 | npm run start-prod 38 | 39 | Server will be listening on [http://localhost:8282](http://localhost:8282), with gzip content compression enabled. 40 | 41 | ### Using Visual Studio 42 | 43 | ##### Setup 44 | 45 | 1. Setup [Visual Studio 2015](https://www.visualstudio.com/downloads/) (for example, Community Edition) 46 | 2. Setup [TypeScript for Visual Studio 2015](https://www.microsoft.com/ru-ru/download/confirmation.aspx?id=48593) 47 | 3. Setup [Web Compiler](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebCompiler) extension for working with SCSS from IDE. 48 | 4. Run `gulp build-dev --color` from terminal, to make rxjs bundle. 49 | 50 | ##### Working 51 | 52 | TypeScript and SCSS set up to be compiled on file save. SystemJS loads every file separately, so you only need save your changes, and reload browser window. 53 | 54 | To force recompilation of all files make rebuild of the solution (Alt+B, Alt+R). To force recompilation of SCSS file, `right click -> Web Compiler -> Re-compile file` 55 | 56 | ### Installing dependencies 57 | 58 | If library should be imported via `import` statement into TypeScript, then: 59 | 60 | 1. For development: make sure, that TypeScript will find this library with `tsconfig.json`, and make sure, that SystemJS will find it by `buid-tools/systemjs-config.json`. In some cases nothing needed, in some cases you should map library name to its path, as it made for @angular modules. 61 | 2. For production: make sure, that TypeScript will find this library with `tsconfig.ngc.json`, `tsconfig.prod.json` and make sure, that Rollup will find it by `build-tools/rollup-config.js`. In most cases, `rollup-plugin-node-resolve` plugin will make the work without any setup. 62 | 63 | If library should not be imported, and its only needed to add it page, then: 64 | 65 | 1. For devleopment: add ` 19 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular2-seed", 3 | "author": "Bogatyrev Pavel ", 4 | "license": "Apache 2.0", 5 | "version": "1.0.0", 6 | "description": "Simple yet flexible Angular 2 dev/prod build system.", 7 | "scripts": { 8 | "build": "gulp build-dev --color", 9 | "build-prod": "gulp build-prod --color", 10 | "clean": "gulp clean --color", 11 | "compile": "gulp compile-dev --color", 12 | "start": "node build-tools/express-http-server.dev.js", 13 | "start-prod": "node build-tools/express-http-server.prod.js" 14 | }, 15 | "devDependencies": { 16 | "@angular/compiler-cli": "^2.1.2", 17 | "@angular/platform-server": "^2.1.0", 18 | "@types/node": "^6.0.46", 19 | "browser-resolve": "^1.11.2", 20 | "compression": "^1.6.2", 21 | "del": "^2.2.2", 22 | "event-stream": "^3.3.4", 23 | "express": "^4.14.0", 24 | "file-exists": "^2.0.0", 25 | "glob-intersection": "^0.1.3", 26 | "gulp": "^3.9.1", 27 | "gulp-concat": "^2.6.0", 28 | "gulp-file": "^0.3.0", 29 | "gulp-if": "^2.0.1", 30 | "gulp-inject": "^4.1.0", 31 | "gulp-inject-string": "^1.1.0", 32 | "gulp-ngc": "^0.1.2", 33 | "gulp-print": "^2.0.1", 34 | "gulp-rename": "^1.2.2", 35 | "gulp-replace": "^0.5.4", 36 | "gulp-rollup": "^2.5.1", 37 | "gulp-run": "^1.7.1", 38 | "gulp-sass": "^2.3.2", 39 | "gulp-sourcemaps": "^2.2.0", 40 | "gulp-typescript": "^3.0.2", 41 | "gulp-uglifyjs": "^0.6.2", 42 | "gulp-util": "^3.0.7", 43 | "http-server": "^0.9.0", 44 | "md5": "^2.2.1", 45 | "node.extend": "^1.1.6", 46 | "openurl": "^1.1.1", 47 | "path": "^0.12.7", 48 | "rollup-plugin-node-resolve": "^2.0.0", 49 | "rollup-stream": "^1.14.0", 50 | "run-sequence": "^1.2.2", 51 | "streamqueue": "^1.1.1", 52 | "typescript": "^2.0.6", 53 | "vinyl-buffer": "^1.0.0", 54 | "vinyl-paths": "^2.1.0", 55 | "vinyl-source-stream": "^1.1.0" 56 | }, 57 | "dependencies": { 58 | "@angular/common": "^2.1.0", 59 | "@angular/compiler": "^2.1.0", 60 | "@angular/core": "^2.1.0", 61 | "@angular/forms": "^2.1.2", 62 | "@angular/http": "^2.1.1", 63 | "@angular/platform-browser": "^2.1.0", 64 | "@angular/platform-browser-dynamic": "^2.1.0", 65 | "@angular/router": "^3.1.1", 66 | "es6-shim": "^0.35.2", 67 | "reflect-metadata": "^0.1.3", 68 | "rxjs": "^5.0", 69 | "systemjs": "^0.19.40", 70 | "tslib": "^1.5.0", 71 | "zone.js": "^0.6.25" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "moduleResolution": "node", 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "noEmitHelpers": true, 9 | "lib": ["es6", "dom"] 10 | }, 11 | "include": [ 12 | "app/**/*.ts" 13 | ], 14 | "exclude": [ 15 | "app/main-aot.ts" 16 | ], 17 | "compileOnSave": true 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.ngc.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "moduleResolution": "node", 5 | "experimentalDecorators": true, 6 | "lib": [ "es6", "dom" ] 7 | }, 8 | "include": [ 9 | "app/**/*.ts" 10 | ], 11 | "exclude": [ 12 | "app/main-aot.ts" 13 | ], 14 | "angularCompilerOptions": { 15 | "genDir": "app-aot" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "es6", 5 | "moduleResolution": "node", 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "noEmitHelpers": true, 9 | "lib": [ "es6", "dom" ] 10 | }, 11 | "include": [ 12 | "./app-aot/**/*.ts", 13 | "./app/**/*.ts" 14 | ], 15 | "exclude": [ 16 | "app/main.ts" 17 | ] 18 | } 19 | --------------------------------------------------------------------------------