├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── README.md ├── generators └── app │ ├── angular.png │ ├── index.js │ ├── prompts.json │ ├── src │ ├── files.js │ ├── install.js │ ├── modules.js │ ├── prompts.js │ └── utils.js │ └── templates │ ├── _.babelrc │ ├── _.eslintrc.json │ ├── _.gitignore │ ├── _config │ └── webpack │ │ ├── environments │ │ ├── development.js │ │ └── production.js │ │ └── global.js │ ├── _e2e │ └── main.component.spec.js │ ├── _karma.conf.js │ ├── _package.json │ ├── _postcss.config.js │ ├── _protractor.conf.js │ ├── _spec.bundle.js │ ├── _src │ ├── _app │ │ ├── _components │ │ │ └── _footer │ │ │ │ ├── footer.component.js │ │ │ │ ├── footer.controller.js │ │ │ │ ├── footer.html │ │ │ │ ├── footer.module.js │ │ │ │ └── footer.scss │ │ ├── _core │ │ │ ├── _directives │ │ │ │ └── validation-test │ │ │ │ │ └── validation-test.directive.js │ │ │ ├── _services │ │ │ │ ├── constants.js │ │ │ │ ├── resolver.provider.js │ │ │ │ └── store.factory.js │ │ │ └── core.module.js │ │ ├── _index.bootstrap.js │ │ ├── _index.components.js │ │ ├── _index.config.js │ │ ├── _index.module.js │ │ ├── _index.routes.js │ │ ├── _index.run.js │ │ ├── _index.vendor.js │ │ └── _pages │ │ │ ├── async-page-example │ │ │ ├── async.controller.js │ │ │ ├── async.html │ │ │ ├── async.module.js │ │ │ └── async.scss │ │ │ └── main │ │ │ ├── main.component.js │ │ │ ├── main.controller.js │ │ │ ├── main.controller.spec.js │ │ │ ├── main.html │ │ │ └── main.module.js │ ├── _assets │ │ ├── _images │ │ │ ├── angular.png │ │ │ └── yeoman.png │ │ └── _styles │ │ │ └── _sass │ │ │ └── _index.scss │ ├── _favicon.ico │ └── _tpl-index.ejs │ └── _webpack.config.js ├── package-lock.json └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .idea/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - v5 4 | - v4 5 | - '0.12' 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v1.0.5 (2017-11-22) 2 | 3 | Features: 4 | 5 | - Replace footer directive example with component one. Thanks @dannymy 6 | 7 | ## v1.0.4 (2017-09-17) 8 | 9 | Features: 10 | 11 | - Updated Webpack to v.3 (PR #25, thanks @dannymy) 12 | - Updated UI-router package repo paths (PR #22, thanks @lenin-anzen) 13 | 14 | ## v1.0.0 (2017-02-21) 15 | 16 | Features: 17 | 18 | - Updated Webpack core to latest 19 | - Removed all require statements and replaced with imports 20 | - Add PostCSS config file in application root folder 21 | - Small changes in async page load path 22 | 23 | Bugfixes: 24 | 25 | - Fix alias paths 26 | - Fix images url-loader path 27 | - Fix webpack config to support latest version 28 | 29 | 30 | ## v0.5.0 (2017-02-5) 31 | 32 | Bugfixes: 33 | 34 | - Freeze webpack version 2.2.0-rc3 to solve "exports is not defined" error 35 | 36 | ## v0.4.1 (2016-11-16) 37 | 38 | Features: 39 | 40 | - Updated Webpack config to 2.1.0@beta27 version 41 | - Add small roadmap to README.md 42 | 43 | Bugfixes: 44 | 45 | - Fixed npm run scripts for all platforms 46 | 47 | ## v0.3.2 (2016-10-30) 48 | 49 | Features: 50 | 51 | - Updated Webpack to 2.1.x version 52 | - Updated Babel packages 53 | 54 | Bugfixes: 55 | 56 | - Minor changes in imports structure for more proper vendor packages initialization 57 | 58 | Performane: 59 | 60 | - Provide full support of Webpack@2 Tree Shaking support with Babel integration 61 | 62 | ## v0.2.0 (2016-04-22) 63 | 64 | Features: 65 | 66 | - Updated Babel codebase from 5 to 6 67 | - Added ES2017 preset with polyfills 68 | 69 | Bugfixes: 70 | 71 | - Fixed IE bugs related to ES2017 syntax -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generator-angular-webpack-es6 2 | 3 | [](https://www.npmjs.com/package/generator-angular-webpack-es6) 4 | [](https://www.npmjs.com/package/generator-angular-webpack-es6) 5 | 6 |
© Footer example directive
3 |Just set resolve rule with require.ensure statement and then use angularOcLazyLoad to init module
5 |9 | resolve: { 10 | modulePreloading: function($q, $ocLazyLoad) { 11 | "ngInject"; 12 | 13 | var deferred = $q.defer(); 14 | 15 | require.ensure([], function (require) { 16 | var asyncModule = require('./async.module'); 17 | $ocLazyLoad.load({ 18 | name: asyncModule.default.name, 19 | }); 20 | 21 | deferred.resolve(asyncModule.default.controller); 22 | }); 23 | 24 | return deferred.promise; 25 | } 26 | } 27 |-------------------------------------------------------------------------------- /generators/app/templates/_src/_app/_pages/async-page-example/async.module.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import './async.scss'; 4 | 5 | import asyncController from './async.controller.js'; 6 | 7 | const asyncModule = angular.module('async-module', []); 8 | 9 | asyncModule.controller('asyncController', asyncController); 10 | 11 | export default asyncModule; -------------------------------------------------------------------------------- /generators/app/templates/_src/_app/_pages/async-page-example/async.scss: -------------------------------------------------------------------------------- 1 | .jumbotron.async-box { 2 | background-color: #000; 3 | color: #fff; 4 | } -------------------------------------------------------------------------------- /generators/app/templates/_src/_app/_pages/main/main.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import MainController from './main.controller'; 4 | import mainTpl from './main.html'; 5 | 6 | export default class MainComponent { 7 | constructor() { 8 | this.controller = MainController; 9 | this.templateUrl = mainTpl; 10 | } 11 | } -------------------------------------------------------------------------------- /generators/app/templates/_src/_app/_pages/main/main.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | <% if (props.lodash) { %> 4 | import _ from 'lodash/core'; 5 | <% } %> 6 | <% if (props.moment) { %> 7 | import moment from 'moment'; 8 | <% } %> 9 | 10 | export default class MainController { 11 | constructor($log) { 12 | 'ngInject'; 13 | this.$log = $log; 14 | this.awesomeThings = ['Angular', 'Webpack', 'babel']; 15 | } 16 | 17 | $onInit() { 18 | <% if (props.lodash) { %> 19 | this.lodash_version = _.VERSION; 20 | <% } %> 21 | <% if (props.moment) { %> 22 | this.moment_version = moment.version; 23 | <% } %> 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /generators/app/templates/_src/_app/_pages/main/main.controller.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file includes an example test 3 | for main component controllerusing es6 4 | */ 5 | 6 | // load the target module for test 7 | import mainModule from './main.module'; 8 | 9 | describe('Main component controller',() => { 10 | // load the module 11 | beforeEach(angular.mock.module(mainModule.name)); 12 | 13 | let $componentController; 14 | 15 | // Initialize the component`s controller provider 16 | beforeEach(() => { 17 | angular.mock.inject(_$componentController_ => { 18 | $componentController = _$componentController_; 19 | }); 20 | }); 21 | 22 | it('AwesomeThings has been defined', () => { 23 | let mainComponentCtrl = $componentController('main', null, {}); 24 | expect(mainComponentCtrl.awesomeThings).toBeDefined(); 25 | }); 26 | 27 | it('AwesomeThings has 3 elements', () => { 28 | let mainComponentCtrl = $componentController('main', null, {}); 29 | expect(mainComponentCtrl.awesomeThings.length).toEqual(3); 30 | }); 31 | }); -------------------------------------------------------------------------------- /generators/app/templates/_src/_app/_pages/main/main.html: -------------------------------------------------------------------------------- 1 |
This is a simple angular webpack es6 example, compatible with lazy-loading modules.
5 | <% if (props.lodash) { %> 6 |Lodash version: {{$ctrl.lodash_version}}
7 | <% } %> 8 | <% if (props.moment) { %> 9 |Moment version: {{$ctrl.moment_version}}
10 | <% } %> 11 | <% if (props.ocLazyLoad) { %> 12 | 13 | <% } %> 14 |