当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

angular-webpack-starter

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 华聪
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Complete starter seed project for Angular

Material Branch with Universal (Server-side rendering) support

Featuring Material Design 2, Webpack (and Webpack DLL plugin for faster dev builds), HMR (Hot Module Replacement), @ngrx for state management and optional server-side rendering with Universal.

You can use npm, but it's recommended to use yarn as it installs a lot faster and has other benefits https://yarnpkg.com/ . Make sure you are using yarn version 0.16.0 or newer (check with 'yarn --version')
git clone https://github.com/qdouble/angular-webpack-starter.git
cd angular-webpack-starter
yarn
yarn start

Material Branch without Universal (Server-side rendering) support

Bootstrap Branch

Bootstrap and Universal Branch

Minimal Branch

Features

  • Angular
    • Async loading
    • Treeshaking
    • AOT (Ahead of Time/ Offline) Compilation
    • AOT safe SASS compilation
  • Webpack 4
    • Webpack Dlls (Speeds up devServer builds)
    • @ngTools AOT plugin
  • HMR (Hot Module Replacement)
  • TypeScript 2
    • @types
  • Material Design 2
  • Universal (Server-side Rendering)
  • @ngrx
    • store (RxJS powered state management for Angular apps, inspired by Redux)
    • effects (Side effect model for @ngrx/store)
    • router-store (Bindings to connect angular/router to ngrx/store)
    • store-devtools (Developer Tools for @ngrx/store)
    • ngrx-store-logger (Advanced console logging for @ngrx/store applications, ported from redux-logger.)
    • ngrx-store-freeze in dev mode (@ngrx/store meta reducer that prevents state from being mutated.)
  • Karma/Jasmine testing
  • Protractor for E2E testing

Project Goals

  • The main goal is to provide an environment where you can have great dev tools and create a production application without worrying about adding a bunch of stuff yourself.
  • The goal of your design should be so that you can easily copy and paste your app folder and your constants file into to a new update of this project and have it still work. Use constants and have proper separation to make upgrades easy. If you have any suggestions on areas where this starter can be designed to make updates more easy, file an issue.

Basic scripts

Use yarn start for dev server. Default dev port is 3000.

Use yarn run start:hmr to run dev server in HMR mode.

Use yarn run build for production build.

Use yarn run server:prod for production server and production watch. Default production port is 8088.

Use yarn run universal to run production build in Universal. To run and build universal in AOT mode, useyarn run universal:aot. Default universal port is 8000.

Default ports and option to use proxy backend for dev server can be changed in constants.js file.

To create AOT version, run yarn run build:aot. This will compile and build script.Then you can use yarn run prodserver to see to serve files.

Store Logger

There is also an option to use store-logger which outputs ngrx action history to the console.To set your development mode store logging preference, go to the constant.js file and edit the STORE_DEV_TOOLS constant.Available options are logger | none

HMR (Hot Module Replacement)

HMR mode allows you to update a particular module without reloading the entire application.The current state of your app is also stored in @ngrx/store allowing you to make updates to yourcode without losing your currently stored state.

AOT Don'ts

The following are some things that will make AOT compile fail.

  • Don’t use require statements for your templates or styles, use styleUrls and templateUrls, the angular2-template-loader plugin will change it to require at build time.
  • Don’t use default exports.
  • Don’t use form.controls.controlName, use form.get(‘controlName’)
  • Don’t use control.errors?.someError, use control.hasError(‘someError’)
  • Don’t use functions in your providers, routes or declarations, export a function and then reference that function name
  • Inputs, Outputs, View or Content Child(ren), Hostbindings, and any field you use from the template or annotate for Angular should be public

Testing

For unit tests, use yarn run test for continuous testing in watch mode and useyarn run test:once for single test. To view code coverage after running test, open coverage/html/index.html in your browser.

For e2e tests, use yarn run e2e. To run unit test and e2e test at the same time, use yarn run ci.

Wiki Links

Recommended Steps for merging this starter into existing project

License

MIT

  • 前言: 在哪看到过angular程序员被React程序员鄙视,略显尴尬,确实Angular挺值得被调侃的,在1.*版本存在的几个性能问题,性能优化的“潜规则”贼多,以及从1.*到2.*版本的面目全非,不过宽容点来看这个强大的框架,升级到ng2肯定是一件好事情,虽然截至目前ng2还存在或多或少需要完善的地方,但是ng2做到了留下并强化ng1好的部分,移除或改善其不好的部分,并且基于许多较新Web技术

  • Webpack 入门指南 - 1.安装 Webpack 入门指南 - 2.模块 这一次,我们使用 Webpack 来打包 Angular 2 的应用。 与官方的 Hello, Angular 2 项目相比,我们不使用 System.js,而是使用 TypeScript 直接编译,然后使用 Webpack 打包生成代码。 1. 下载 Angular 2 以及依赖包 修改我们的 package.jso

  • 一.使用Webpack 1.Webpack命令 webpack -h帮助命令 webpack -v查看版本 webpack <entry> [<entry>] <output>输入一个或多个entry打包命令 2.Webpack-cli 安装npm install -g webpack-cli 作用:交互式的初始化一个项目 初始化webpack项目webpack-cli init 项目名 3.We

  • 概述 Angular2官方推荐的应该是使用systemjs加载, 但是当我使用到它的tree shaking的时候,发现如果使用systemjs+rollup,只能打包成一个文件,然后lazy loading就没法搞了。 因此我使用了webpack2,webpack2自带tree shaking,只要将tsconfig中的module设置成es2015就可以, 虽然效果没rollup好,但支持la

 相关资料
  • generator-angular-webpack-es6 Yeoman generator for AngularJS + Webpack with ES6 and SASS. Latest Webpack with Tree Shaking feature enabled Babel 6 with ES2017 features included Perfectly compatible wi

  • 不幸的是,我不允许共享任何代码。但如果有人有任何建议,我将非常感激。

  • 下面是我得到的解析错误。 错误:模板分析错误:无法绑定到“routerlink”,因为它不是“a”的已知属性。(“r>Menu][routerlink]=r.routerlink[routerlinkactive]=”['active']“>{{r.text}}”):t@0:359无法绑定到“routerlinkactive”,因为它不是“a”的已知属性。(“项ui红色”*ngfor=“让r个路由

  • 我刚刚将我的项目从angular-cli beta.10升级到angular-cli@WebPack(beta.18),现在我的specs.ts都没有解析(找不到名称'description'等)。有关于如何为我的项目配置单元测试的信息吗?

  • 问题内容: 希望能弄清为什么以下内容无法按预期工作,希望这是我可能忽略的简单事情。如果没有Webpack,当前的实现将按预期工作。 理想情况下,想保持当前的实现,我觉得组件/控制器/等的注册应在其自己的文件中完成,并且仅指向相关模块。但是,如果这不是最佳做法,那么我也想看看另一个建议。 文件root.module是我定义根模块的位置,然后在root.component文件中,将组件附加到该模块上。

  • 我已经广泛地搜索了这个问题,但没有找到任何修复它的方法。我正在尝试使用webpack来运行单个jasmine测试。我试图在Angular网站上遵循教程,但它...不是真的正确或完整。 null