├── .eslintrc ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── README.md ├── app ├── index.js └── templates │ ├── common │ ├── .editorconfig │ ├── .htmlhintrc │ ├── .scss-lint.yml │ ├── README.md │ ├── _package.json │ ├── config.json │ ├── gitignore │ ├── gulpfile.js │ ├── karma.conf.js │ ├── modernizr-config.json │ ├── protractor.conf.js │ ├── src │ │ ├── .htaccess │ │ ├── assets │ │ │ └── README.md │ │ ├── data │ │ │ ├── page-01.json │ │ │ └── page-02.json │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── scripts │ │ │ └── data │ │ │ │ ├── app-copy.json │ │ │ │ ├── loader-common.json │ │ │ │ ├── loader-no-retina.json │ │ │ │ ├── loader-retina.json │ │ │ │ └── version.json │ │ ├── scss │ │ │ ├── _base.scss │ │ │ ├── _fonts.scss │ │ │ ├── _shared.scss │ │ │ ├── assets │ │ │ │ ├── _assets.scss │ │ │ │ ├── assets-no-retina.scss │ │ │ │ └── assets-retina.scss │ │ │ ├── modules │ │ │ │ ├── _animation.scss │ │ │ │ ├── _canvas.scss │ │ │ │ ├── _incompatible-browser.scss │ │ │ │ ├── _loader.scss │ │ │ │ └── _version.scss │ │ │ └── style.scss │ │ └── tpls │ │ │ ├── partials │ │ │ ├── footer.html │ │ │ └── header.html │ │ │ └── views │ │ │ ├── detail.html │ │ │ ├── home.html │ │ │ └── page1.html │ ├── webpack.config.js │ └── website │ │ └── assets │ │ ├── fonts │ │ ├── generica.eot │ │ ├── generica.svg │ │ ├── generica.ttf │ │ └── generica.woff │ │ └── images │ │ ├── IMG-1.jpg │ │ ├── IMG-1_2x.jpg │ │ ├── IMG-2.jpg │ │ ├── IMG-2_2x.jpg │ │ ├── plane.png │ │ └── plane_2x.png │ ├── es2015 │ ├── .babelrc │ ├── .eslintrc │ ├── src │ │ └── scripts │ │ │ ├── app │ │ │ ├── animations │ │ │ │ ├── _loader.js │ │ │ │ ├── _mAnimations.js │ │ │ │ └── routerAnimation.js │ │ │ ├── controllers │ │ │ │ ├── DetailCtrl.js │ │ │ │ ├── MyCtrl.js │ │ │ │ ├── _loader.js │ │ │ │ └── _mCtrls.js │ │ │ ├── directives │ │ │ │ ├── _loader.js │ │ │ │ ├── _mDirectives.js │ │ │ │ └── templateDirective.js │ │ │ ├── mApp.js │ │ │ ├── services │ │ │ │ ├── _loader.js │ │ │ │ ├── _mServices.js │ │ │ │ └── templateFactory.js │ │ │ └── utilities │ │ │ │ └── getModuleInstance.js │ │ │ ├── canvas │ │ │ ├── Canvas.js │ │ │ └── Plane.js │ │ │ ├── main.js │ │ │ └── utilities │ │ │ ├── appSettings.js │ │ │ ├── incompDetect.js │ │ │ ├── incompatible.js │ │ │ ├── loader.js │ │ │ ├── loaderData.js │ │ │ └── version.js │ └── test │ │ ├── e2e │ │ └── spec.js │ │ └── unit │ │ ├── _enterSpec.js │ │ ├── controllersSpec.js │ │ ├── directivesSpec.js │ │ ├── filtersSpec.js │ │ └── servicesSpec.js │ └── es5 │ ├── .eslintrc │ ├── src │ └── scripts │ │ ├── app │ │ ├── animations │ │ │ ├── _loader.js │ │ │ ├── _mAnimations.js │ │ │ └── routerAnimation.js │ │ ├── controllers │ │ │ ├── DetailCtrl.js │ │ │ ├── MyCtrl.js │ │ │ ├── _loader.js │ │ │ └── _mCtrls.js │ │ ├── directives │ │ │ ├── _loader.js │ │ │ ├── _mDirectives.js │ │ │ └── templateDirective.js │ │ ├── mApp.js │ │ ├── services │ │ │ ├── _loader.js │ │ │ ├── _mServices.js │ │ │ └── templateFactory.js │ │ └── utilities │ │ │ └── getModuleInstance.js │ │ ├── canvas │ │ ├── Canvas.js │ │ └── Plane.js │ │ ├── main.js │ │ └── utilities │ │ ├── appSettings.js │ │ ├── incompDetect.js │ │ ├── incompatible.js │ │ ├── loader.js │ │ ├── loaderData.js │ │ └── version.js │ └── test │ ├── e2e │ └── spec.js │ └── unit │ ├── _enterSpec.js │ ├── controllersSpec.js │ ├── directivesSpec.js │ ├── filtersSpec.js │ └── servicesSpec.js └── package.json /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "ecmaVersion": 5 4 | }, 5 | "rules": { 6 | "no-console": 0, 7 | "no-debugger": 0, 8 | "no-unexpected-multiline": 2, 9 | "indent": [2, 4, { "SwitchCase": 1 }], 10 | "quotes": [2, "single"], 11 | "semi": [2, "always"], 12 | "strict": 2, 13 | "curly": 2, 14 | "camelcase": [2, {"properties": "always"}], 15 | "eqeqeq": [2, "smart"], 16 | "no-extend-native": 2, 17 | "guard-for-in": 2, 18 | "wrap-iife": [2, "inside"], 19 | "new-cap": 2, 20 | "no-caller": 2, 21 | "no-eval": 2, 22 | "no-use-before-define": 2, 23 | "no-inner-declarations": [2, "both"], 24 | "no-loop-func": 2, 25 | "no-multi-str": 2, 26 | "no-shadow-restricted-names": 2, 27 | "no-shadow": 2, 28 | "new-parens": 2, 29 | "no-invalid-this": 2, 30 | "space-before-function-paren": [2, { "anonymous": "always", "named": "never" }], 31 | "keyword-spacing": 2, 32 | "no-labels": 2, 33 | "block-spacing": [2, "always"], 34 | "space-before-blocks": 2, 35 | "space-infix-ops": 2, 36 | "comma-spacing": [2, { "before": false, "after": true }], 37 | "array-bracket-spacing": [2, "never"], 38 | "space-unary-ops": [1, { "words": true, "nonwords": false }], 39 | "semi-spacing": [2, {"before": false, "after": true}], 40 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 41 | "eol-last": 2, 42 | "spaced-comment": [2, "always"], 43 | "dot-notation": 2, 44 | "no-lone-blocks": 2, 45 | "no-redeclare": 2, 46 | "no-with": 2, 47 | "global-require": 0, 48 | "comma-style": [2, "last"], 49 | "computed-property-spacing": [2, "never"], 50 | "key-spacing": 2, 51 | "newline-after-var": [2, "always"], 52 | "no-array-constructor": 2, 53 | "no-multiple-empty-lines": 2, 54 | "no-spaced-func": 2, 55 | "object-curly-spacing": [2, "always"], 56 | "space-in-parens": [2, "never"], 57 | "arrow-spacing": 2 58 | }, 59 | "env": { 60 | "es6": true, 61 | "node": true, 62 | "browser": true, 63 | "commonjs": true, 64 | "jasmine": true 65 | }, 66 | "extends": "eslint:recommended", 67 | 68 | "globals": {} 69 | } 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Windows ### 4 | # Windows image file caches 5 | Thumbs.db 6 | ehthumbs.db 7 | 8 | # Folder config file 9 | Desktop.ini 10 | 11 | # Recycle Bin used on file shares 12 | $RECYCLE.BIN/ 13 | 14 | # Windows Installer files 15 | *.cab 16 | *.msi 17 | *.msm 18 | *.msp 19 | 20 | # Windows shortcuts 21 | *.lnk 22 | 23 | 24 | ### OSX ### 25 | .DS_Store 26 | .AppleDouble 27 | .LSOverride 28 | 29 | # Icon must end with two \r 30 | Icon 31 | 32 | 33 | # Thumbnails 34 | ._* 35 | 36 | # Files that might appear on external disk 37 | .Spotlight-V100 38 | .Trashes 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | 48 | ### Linux ### 49 | *~ 50 | 51 | # KDE directory preferences 52 | .directory 53 | 54 | 55 | ### Sass ### 56 | .sass-cache 57 | 58 | 59 | ### Node ### 60 | # Logs 61 | logs 62 | *.log 63 | 64 | # Runtime data 65 | pids 66 | *.pid 67 | *.seed 68 | 69 | # Directory for instrumented libs generated by jscoverage/JSCover 70 | lib-cov 71 | 72 | # Coverage directory used by tools like istanbul 73 | coverage 74 | 75 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 76 | .grunt 77 | 78 | # node-waf configuration 79 | .lock-wscript 80 | 81 | # Compiled binary addons (http://nodejs.org/api/addons.html) 82 | build/Release 83 | 84 | # Dependency directory 85 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 86 | node_modules 87 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "stable" 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## v0.5.9 - 2016-03-29 5 | - Remove jQuery from dependencies 6 | - Handle postCSS errors 7 | - Add gulp data task 8 | 9 | ## v0.5.8 - 2016-03-23 10 | - Add template directive 11 | - Add template service 12 | 13 | ## v0.5.7 - 2016-03-23 14 | - Add gulp-sass-glob 15 | - Update scss linter rules 16 | 17 | ## v0.5.6 - 2016-02-29 18 | - Put babel configuration to .babelrc file 19 | - Clean gulp bump task 20 | 21 | ## v0.5.5 - 2016-02-26 22 | - Add .editorconfig file 23 | 24 | ## v0.5.4 - 2016-02-24 25 | - Fix ng-annotate not working in ES2015 26 | - Turn on angular strict DI mode 27 | 28 | ## v0.5.3 - 2016-02-24 29 | - Use import / export syntax for ES2015 modules 30 | 31 | ## v0.5.2 - 2016-02-21 32 | - Use webpack watch instead of gulp watch 33 | - Simplify webpack console logs 34 | 35 | ## v0.5.1 - 2016-02-16 36 | - Improve webpack + gulp build 37 | 38 | ## v0.5.0 - 2016-02-16 39 | - Bower was removed 40 | - All JavaScript libraries are managed with npm 41 | - All JavaScript files are built with webpack including libraries 42 | - Update to ESLint 2.0.0 43 | - Add json linter to data build task 44 | - Gulp connect was replaced with BrowserSync 45 | - Change unit and e2e test logic 46 | - Update dependencies 47 | - Bug fixing 48 | 49 | ## v0.4.4 - 2016-02-11 50 | - Change singleton pattern for webpack modules to use global object 51 | 52 | ## v0.4.3 - 2016-02-09 53 | - Fix webpack build to run multiple entry points on one page 54 | 55 | ## v0.4.2 - 2016-02-09 56 | - Changes in html and scss linter configuration files, changed build notifications logic, 57 | removed retina-asset mixin in favor of Bourbon retina-image mixin, renamed retina template images 58 | for consistency with Bourbon 59 | 60 | ## v0.4.1 - 2016-02-08 61 | - Fix readme file 62 | 63 | ## v0.4.0 - 2016-02-08 64 | - JavaScript in header is built with Webpack, SCSS is built with libSass and PostCSS, 65 | Added SCSS-Lint and HTMLHint configuration files, Added SCSS libraries Bourbon and Neat, 66 | Added normalize.css, Updated all dependencies to newest versions 67 | 68 | ## v0.3.1 - 2016-01-12 69 | - Fix readme 70 | 71 | ## v0.3.0 - 2016-01-12 72 | - Add ES2015 (Babel) 73 | 74 | ## v0.2.5 - 2016-01-07 75 | - Add build version info 76 | 77 | ## v0.2.4 - 2016-01-07 78 | - Added ESLint, updated build process, update to newest npm packages 79 | 80 | ## v0.2.3 - 2015-09-04 81 | - Added pixi.js, fix watching index.html file 82 | 83 | ## v0.2.2 - 2015-07-29 84 | - Fix: incompatible browser detection, support of old browsers 85 | 86 | ## v0.2.1 - 2015-07-29 87 | - Fix: remove inline font from css 88 | 89 | ## v0.2.0 - 2015-07-29 90 | - New minor version - many improvements and changes 91 | 92 | ## v0.1.3 - 2015-06-02 93 | - Fix gulp clean task 94 | 95 | ## v0.1.2 - 2015-06-01 96 | - Add possibility to choose optional libraries 97 | 98 | ## v0.1.1 - 2015-05-29 99 | - Fix bug with generating gitingone file 100 | 101 | ## v0.1.0 - 2015-05-29 102 | - Initial release 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular Webpack generator 2 | ## ES2015 (Babel) or ES5 3 | 4 | [![Build Status](https://travis-ci.org/KarolAltamirano/generator-angular-webpack.svg?branch=master)](https://travis-ci.org/KarolAltamirano/generator-angular-webpack) 5 | [![Dependency Status](https://david-dm.org/KarolAltamirano/generator-angular-webpack.svg)](https://david-dm.org/KarolAltamirano/generator-angular-webpack) 6 | [![npm version](https://badge.fury.io/js/generator-angular-webpack.svg)](https://badge.fury.io/js/generator-angular-webpack) 7 | 8 | ## Getting Started 9 | ### Requirements 10 | - NodeJS v4.0 or newer 11 | - npm v3.3 or newer 12 | - yo (to install run `npm install -g yo`) 13 | - gulp (read [Getting Started guide](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md)) 14 | 15 | ### Installation 16 | - Install: `npm install -g generator-angular-webpack` 17 | - Run: `yo angular-webpack` 18 | - Run: `gulp` to build for development and watch for file changes or `gulp build --dist` to build for production 19 | 20 | ### More details inside a project readme file 21 | - To see the readme file 22 | [click here](https://github.com/KarolAltamirano/generator-angular-webpack/blob/master/app/templates/common/README.md) 23 | -------------------------------------------------------------------------------- /app/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Main file of Yeoman generator for AngularJS with Webpack 3 | * @author Karol Altamirano 4 | * @copyright 2015-2016 Karol Altamirano 5 | * @license MIT 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var generators = require('yeoman-generator'), 11 | chalk = require('chalk'), 12 | yosay = require('yosay'), 13 | _ = require('lodash'); 14 | 15 | module.exports = generators.Base.extend({ 16 | prompting: function () { 17 | var done = this.async(); 18 | 19 | this.log(yosay('Welcome to the ' + chalk.green('Angular-Webpack') + ' generator!')); 20 | 21 | var prompts = [ 22 | { 23 | type: 'input', 24 | name: 'name', 25 | message: 'Your project name (use camelCase)', 26 | default: _.camelCase(this.appname) 27 | }, 28 | { 29 | type: 'list', 30 | name: 'canvasLibrarie', 31 | message: 'Select canvas library', 32 | choices: ['Do not install', 'Pixi.js', 'EaselJS'] 33 | }, 34 | { 35 | type: 'checkbox', 36 | name: 'optionalLibraries', 37 | message: 'Select optional libraries to install', 38 | choices: [ 39 | { 40 | name: 'SoundJS' 41 | }, 42 | { 43 | name: 'stats.js' 44 | }, 45 | { 46 | name: 'dat-gui' 47 | } 48 | ] 49 | }, 50 | { 51 | type: 'list', 52 | name: 'jsVersion', 53 | message: 'What JavaScript version do you want to use?', 54 | choices: ['ECMAScript 5', 'ECMAScript 2015 (with Babel compiler)'] 55 | } 56 | ]; 57 | 58 | this.prompt(prompts, function (props) { 59 | var selectedPrompt = function (name, input) { return input.indexOf(name) !== -1; }; 60 | 61 | this.props = props; 62 | 63 | this.pixijs = selectedPrompt('Pixi.js', props.canvasLibrarie); 64 | this.easeljs = selectedPrompt('EaselJS', props.canvasLibrarie); 65 | 66 | this.soundjs = selectedPrompt('SoundJS', props.optionalLibraries); 67 | this.statsjs = selectedPrompt('stats.js', props.optionalLibraries); 68 | this.datgui = selectedPrompt('dat-gui', props.optionalLibraries); 69 | 70 | this.es2015 = selectedPrompt('ECMAScript 2015 (with Babel compiler)', props.jsVersion); 71 | 72 | done(); 73 | }.bind(this)); 74 | }, 75 | writing: function () { 76 | var COMMON_FOLDER = 'common', 77 | VERSION_FOLDER; 78 | 79 | if (this.es2015) { 80 | VERSION_FOLDER = 'es2015'; 81 | } else { 82 | VERSION_FOLDER = 'es5'; 83 | } 84 | 85 | // root files 86 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/.editorconfig'), this.destinationPath('.editorconfig')); 87 | 88 | this.fs.copyTpl( 89 | this.templatePath(COMMON_FOLDER + '/_package.json'), 90 | this.destinationPath('package.json'), 91 | { 92 | name: this.props.name, 93 | es2015: this.es2015, 94 | pixijs: this.pixijs, 95 | soundjs: this.soundjs, 96 | easeljs: this.easeljs, 97 | statsjs: this.statsjs, 98 | datgui: this.datgui 99 | } 100 | ); 101 | 102 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/.htmlhintrc'), this.destinationPath('.htmlhintrc')); 103 | 104 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/.scss-lint.yml'), this.destinationPath('.scss-lint.yml')); 105 | 106 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/config.json'), this.destinationPath('config.json')); 107 | 108 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/gitignore'), this.destinationPath('.gitignore')); 109 | 110 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/gulpfile.js'), this.destinationPath('gulpfile.js')); 111 | 112 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/karma.conf.js'), this.destinationPath('karma.conf.js')); 113 | 114 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/modernizr-config.json'), this.destinationPath('modernizr-config.json')); 115 | 116 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/protractor.conf.js'), this.destinationPath('protractor.conf.js')); 117 | 118 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/README.md'), this.destinationPath('README.md')); 119 | 120 | this.fs.copyTpl( 121 | this.templatePath(COMMON_FOLDER + '/webpack.config.js'), 122 | this.destinationPath('webpack.config.js'), 123 | { 124 | es2015: this.es2015, 125 | pixijs: this.pixijs, 126 | soundjs: this.soundjs, 127 | easeljs: this.easeljs, 128 | statsjs: this.statsjs, 129 | datgui: this.datgui 130 | } 131 | ); 132 | 133 | if (this.es2015) { 134 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/.babelrc'), this.destinationPath('.babelrc')); 135 | } 136 | 137 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/.eslintrc'), this.destinationPath('.eslintrc')); 138 | 139 | // src folder 140 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/assets/**'), this.destinationPath('src/assets/')); 141 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/data/**'), this.destinationPath('src/data/')); 142 | 143 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scripts/data/**'), this.destinationPath('src/scripts/data/')); 144 | 145 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/app/animations/**'), this.destinationPath('src/scripts/app/animations/')); 146 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/app/controllers/**'), this.destinationPath('src/scripts/app/controllers/')); 147 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/app/directives/**'), this.destinationPath('src/scripts/app/directives/')); 148 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/app/services/**'), this.destinationPath('src/scripts/app/services')); 149 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/app/utilities/**'), this.destinationPath('src/scripts/app/utilities')); 150 | this.fs.copyTpl( 151 | this.templatePath(VERSION_FOLDER + '/src/scripts/app/mApp.js'), 152 | this.destinationPath('src/scripts/app/mApp.js'), 153 | { pixijs: this.pixijs } 154 | ); 155 | 156 | if (this.pixijs) { 157 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/canvas/**'), this.destinationPath('src/scripts/canvas/')); 158 | } 159 | 160 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/utilities/appSettings.js'), this.destinationPath('src/scripts/utilities/appSettings.js')); 161 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/utilities/incompatible.js'), this.destinationPath('src/scripts/utilities/incompatible.js')); 162 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/utilities/incompDetect.js'), this.destinationPath('src/scripts/utilities/incompDetect.js')); 163 | this.fs.copyTpl( 164 | this.templatePath(VERSION_FOLDER + '/src/scripts/utilities/loader.js'), 165 | this.destinationPath('src/scripts/utilities/loader.js'), 166 | { soundjs: this.soundjs, easeljs: this.easeljs } 167 | ); 168 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/utilities/loaderData.js'), this.destinationPath('src/scripts/utilities/loaderData.js')); 169 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/utilities/version.js'), this.destinationPath('src/scripts/utilities/version.js')); 170 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/src/scripts/main.js'), this.destinationPath('src/scripts/main.js')); 171 | 172 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/assets/**'), this.destinationPath('src/scss/assets/')); 173 | 174 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/modules/_animation.scss'), this.destinationPath('src/scss/modules/_animation.scss')); 175 | if (this.pixijs) { 176 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/modules/_canvas.scss'), this.destinationPath('src/scss/modules/_canvas.scss')); 177 | } 178 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/modules/_incompatible-browser.scss'), this.destinationPath('src/scss/modules/_incompatible-browser.scss')); 179 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/modules/_loader.scss'), this.destinationPath('src/scss/modules/_loader.scss')); 180 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/modules/_version.scss'), this.destinationPath('src/scss/modules/_version.scss')); 181 | 182 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/_base.scss'), this.destinationPath('src/scss/_base.scss')); 183 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/_fonts.scss'), this.destinationPath('src/scss/_fonts.scss')); 184 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/_shared.scss'), this.destinationPath('src/scss/_shared.scss')); 185 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/scss/style.scss'), this.destinationPath('src/scss/style.scss')); 186 | 187 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/tpls/**'), this.destinationPath('src/tpls/')); 188 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/.htaccess'), this.destinationPath('src/.htaccess')); 189 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/src/favicon.ico'), this.destinationPath('src/favicon.ico')); 190 | this.fs.copyTpl( 191 | this.templatePath(COMMON_FOLDER + '/src/index.html'), 192 | this.destinationPath('src/index.html'), 193 | { pixijs: this.pixijs } 194 | ); 195 | 196 | // test folder 197 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/test/e2e/**'), this.destinationPath('test/e2e/')); 198 | this.fs.copy(this.templatePath(VERSION_FOLDER + '/test/unit/**'), this.destinationPath('test/unit/')); 199 | 200 | // website folder 201 | this.fs.copy(this.templatePath(COMMON_FOLDER + '/website/**'), this.destinationPath('website/')); 202 | 203 | }, 204 | install: function () { 205 | this.npmInstall(); 206 | } 207 | }); 208 | -------------------------------------------------------------------------------- /app/templates/common/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 4 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [package.json] 13 | indent_style = space 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /app/templates/common/.htmlhintrc: -------------------------------------------------------------------------------- 1 | { 2 | "tagname-lowercase": true, 3 | "attr-lowercase": true, 4 | "attr-value-double-quotes": true, 5 | "tag-pair": true, 6 | "spec-char-escape": true, 7 | "id-unique": true, 8 | "src-not-empty": true, 9 | "attr-no-duplication": true, 10 | "title-require": true, 11 | "space-tab-mixed-disabled": "space", 12 | "doctype-html5": true 13 | } 14 | -------------------------------------------------------------------------------- /app/templates/common/.scss-lint.yml: -------------------------------------------------------------------------------- 1 | linters: 2 | 3 | Indentation: 4 | width: 4 5 | 6 | PropertySortOrder: 7 | order: smacss 8 | 9 | NestingDepth: 10 | enabled: false 11 | 12 | LeadingZero: 13 | enabled: true 14 | style: 'include_zero' 15 | -------------------------------------------------------------------------------- /app/templates/common/README.md: -------------------------------------------------------------------------------- 1 | # Angular with Webpack 2 | Project was generated with Yeoman generator 3 | [generator-angular-webpack](https://www.npmjs.com/package/generator-angular-webpack) 4 | 5 | # Requirements 6 | - NodeJS v4.0 or newer 7 | - npm v3.3 or newer 8 | - gulp (read [Getting Started guide](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md)) 9 | 10 | # Install all npm dependencies for development 11 | - Skip this step if you have generated the project with Yeoman. Yeoman install all dependencies for you. 12 | - To install all development dependencies of existing project run `npm install` inside the root 13 | directory of the project. 14 | 15 | # Root folders 16 | ``` 17 | src : source code 18 | test : unit and e2e test scripts 19 | website : built page (do not edit files there) 20 | ``` 21 | 22 | # 'src' folder 23 | ``` 24 | assets : don't place assets here. Add assets to /website/assets/ folder. 25 | data : json files preloaded with preloadjs 26 | scripts : app - angular app 27 | data - json files required with webpack 28 | utilities - app classes and objects 29 | main.js - main app file 30 | scss : assets - styles preloaded with preloadjs (for inline images) 31 | edit _assets.scss 32 | use just for a small icons (no big images) 33 | modules - scss modules 34 | _base - default styling 35 | _fonts - page fonts 36 | _shared - scss variables and mixins shared in all scss files 37 | style - main style file 38 | tpls : html templates 39 | ``` 40 | 41 | # 'website' folder 42 | ``` 43 | assets : media files (images, sprites, video, audio ...) 44 | ``` 45 | 46 | # Gulp tasks 47 | ``` 48 | gulp build : build for development 49 | gulp watch : watch for changes and rebuild updated file 50 | gulp : default task runs 'gulp watch' 51 | gulp build --dist : build for production 52 | gulp browser-sync : create http server for testing 53 | gulp data : build json data from 'src/data/' directory 54 | gulp bump --major : bump major version 55 | gulp bump --minor : bump minor version 56 | gulp bump --patch : bump patch version 57 | ``` 58 | 59 | # Webpack 60 | ## Installing JavaScript libraries 61 | - Install libraries with npm. 62 | 63 | ## Installing JavaScript libraries with broken module style 64 | - If new installed library doesn't work properly with webpack read more about shimming modules 65 | [here](http://webpack.github.io/docs/shimming-modules.html). 66 | 67 | ## Installing JavaScript libraries not published in npm 68 | - If you want to install library not published in npm but with `package.json` inside git repository 69 | you can install package from git repository. Read [here](https://docs.npmjs.com/cli/install) how to 70 | install it. 71 | - If you want to install library not published in npm and without `package.json` you can install it 72 | from git repository with [`napa`](https://github.com/shama/napa). 73 | - To install new library add it to `package.json` file to `napa` variable and run `npm install`. 74 | More details how to use `napa` can be found [here](https://github.com/shama/napa). 75 | - Probably you will need to set `resolve.alias` and `loaders` inside `webpack.config.js` for 76 | libraries not published in npm. 77 | 78 | # Modernizr configuration 79 | - To configure modernizr change its settings inside `modernizr-config.json`. 80 | - List of all available settings: 81 | [show](https://github.com/Modernizr/Modernizr/blob/master/lib/config-all.json) 82 | 83 | # CSS compatibility configuration 84 | - To set autoprefixer for CSS set `AUTO_PREFIXER_RULES` variable inside `gulpfile.js`. 85 | - Default value: `['last 2 versions']`. 86 | - List of available values: [show](https://github.com/ai/browserslist#queries) 87 | 88 | # Config file 'config.json' 89 | ``` 90 | root : List of files to copy to website root folder 91 | scssIncludePaths : Array of sass libraries 92 | cssVendor : Array of css libraries installed with npm 93 | ``` 94 | 95 | # Build version 96 | To hide build version info set `renderVersionInfo` to `false` inside `src/scripts/utilities/appSettings.js` file. 97 | To bump version use gulp task `gulp bump --major | --minor | --patch` 98 | 99 | # Test 100 | Run unit tests with `karma start` or e2e tests with `protractor` 101 | - Karma homepage: [show](https://karma-runner.github.io/0.13/index.html) 102 | - Protractor homepage: [show](https://angular.github.io/protractor/#/) 103 | 104 | # Linting 105 | Use linter in your text editor for JavaScript, SCSS and HTML. 106 | 107 | ## JavaScript 108 | - For JavaScript use [ESLint](http://eslint.org/). The project contains ESLint configuration 109 | file `.eslintrc` 110 | - Use ESLint version 2.x.x 111 | - ESLint for Atom - [show](https://github.com/AtomLinter/linter-eslint) 112 | - ESLint for Sublime Text - [show](https://github.com/roadhump/SublimeLinter-eslint) 113 | 114 | ## SCSS 115 | - For SCSS use [SCSS-Lint](https://github.com/brigade/scss-lint). The project contains SCSS-Lint 116 | configuration file `.scss-lint.yml` 117 | - SCSS-Lint for Atom - [show](https://github.com/AtomLinter/linter-scss-lint) 118 | - SCSS-Lint for Sublime Text - [show](https://github.com/attenzione/SublimeLinter-scss-lint) 119 | 120 | ## HTML 121 | - For HTML use [HTMLHint](https://github.com/yaniswang/HTMLHint). The project contains HTMLHint 122 | configuration file `.htmlhintrc` 123 | - HTMLHint for Atom - [show](https://github.com/AtomLinter/linter-htmlhint) 124 | - HTMLHint for Sublime Text - [show](https://github.com/mmaday/SublimeLinter-contrib-htmlhint) 125 | 126 | # SCSS 127 | ## Bourbon 128 | Mixin library for Sass. Check Bourbon [homepage](http://bourbon.io/) for more details and documentation. 129 | **Do not use Bourbon mixins for Vendor Prefixes!** SCSS build uses `autoprefixer` for them. 130 | 131 | Examples: 132 | ``` 133 | HiDPI Media Query: 134 | 135 | @include hidpi(1.5) { 136 | width: 20em; 137 | } 138 | 139 | Font Face: 140 | 141 | @include font-face('generica', '../assets/fonts/generica', $file-formats: eot woff ttf svg); 142 | 143 | Retina Image: 144 | 145 | @retina-image($filename, $background-size, $extension*, $retina-filename*, $retina-suffix*, $asset-pipeline*) 146 | 147 | Argument Defaults: 148 | $extension: png 149 | $retina-filename: null 150 | $retina-suffix: _2x 151 | $asset-pipeline: false 152 | ``` 153 | 154 | ## Neat 155 | Grid framework for Sass and Bourbon. Check Neat [homepage](http://neat.bourbon.io/) for 156 | more details and documentation. 157 | 158 | Examples: [here](http://neat.bourbon.io/examples/) 159 | 160 | ## Assets mixin 161 | ``` 162 | @include retina-inline-asset($name, $ext: 'png') 163 | 164 | Mixin for generating css with background image encoded in base64 for non-retina and retina screens. 165 | Use this mixin only in `/src/scss/assets/_assets.scss` and only for small icons and logos. 166 | ``` 167 | -------------------------------------------------------------------------------- /app/templates/common/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= name %>", 3 | "version": "0.0.0", 4 | "private": true, 5 | "devDependencies": { 6 | "autoprefixer": "^6.3.3"<% if (es2015) { %>, 7 | "babel-core": "^6.5.1", 8 | "babel-loader": "^6.2.2", 9 | "babel-preset-es2015": "^6.5.0"<% } %>, 10 | "browser-sync": "^2.11.1", 11 | "connect-history-api-fallback": "^1.1.0", 12 | "cssnano": "^3.5.2", 13 | "del": "^2.2.0", 14 | "exports-loader": "^0.6.3", 15 | "gulp": "^3.9.1", 16 | "gulp-bump": "^1.0.0", 17 | "gulp-concat": "^2.6.0", 18 | "gulp-eslint": "^2.0.0", 19 | "gulp-extend": "^0.2.0", 20 | "gulp-file": "^0.2.0", 21 | "gulp-if": "^2.0.0", 22 | "gulp-json-editor": "^2.2.1", 23 | "gulp-jsonlint": "^1.1.1", 24 | "gulp-notify": "^2.2.0", 25 | "gulp-postcss": "^6.1.0", 26 | "gulp-sass": "^2.2.0", 27 | "gulp-sass-glob": "^1.0.5", 28 | "gulp-sourcemaps": "^1.6.0", 29 | "gulp-uglify": "^1.5.2", 30 | "gulp-util": "^3.0.7", 31 | "imports-loader": "^0.6.5", 32 | "jasmine-core": "^2.4.1", 33 | "json-loader": "^0.5.4", 34 | "karma": "^0.13.21", 35 | "karma-chrome-launcher": "^0.2.2", 36 | "karma-jasmine": "^0.3.7", 37 | "karma-sourcemap-loader": "^0.3.7", 38 | "karma-spec-reporter": "^0.0.24", 39 | "karma-webpack": "^1.7.0", 40 | "minimist": "^1.2.0", 41 | "modernizr": "^3.3.1", 42 | "moment": "^2.11.2", 43 | "napa": "^2.3.0", 44 | "ng-annotate-loader": "^0.1.0", 45 | "node-notifier": "^4.5.0", 46 | "postcss-assets": "^4.0.1", 47 | "progress-bar-webpack-plugin": "^1.3.0", 48 | "run-sequence": "^1.1.5", 49 | "webpack": "^1.12.13" 50 | }, 51 | "dependencies": { 52 | "angular": "^1.5.0", 53 | "angular-animate": "^1.5.0", 54 | "angular-mocks": "^1.5.0", 55 | "angular-resource": "^1.5.0", 56 | "angular-sanitize": "^1.5.0", 57 | "angular-touch": "^1.5.0", 58 | "angular-ui-router": "^0.2.18"<% if (es2015) { %>, 59 | "babel-polyfill": "^6.5.0"<% } %>, 60 | "bourbon": "^4.2.6", 61 | "bourbon-neat": "^1.7.2"<% if (datgui) { %>, 62 | "dat-gui": "^0.5.0"<% } %>, 63 | "debug": "^2.2.0", 64 | "gsap": "^1.18.2", 65 | "ismobilejs": "^0.3.9", 66 | "normalize.css": "^3.0.3"<% if (pixijs) { %>, 67 | "pixi.js": "^3.0.9"<% } %><% if (statsjs) { %>, 68 | "stats.js": "0.0.14-master"<% } %>, 69 | "ua-parser-js": "^0.7.10" 70 | }, 71 | "scripts": { 72 | "install": "napa" 73 | }, 74 | "napa": { 75 | "PreloadJS": "CreateJS/PreloadJS#0.6.2"<% if (soundjs) { %>, 76 | "SoundJS": "CreateJS/SoundJS#0.6.2"<% } %><% if (easeljs) { %>, 77 | "EaselJS": "CreateJS/EaselJS#0.8.2"<% } %> 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/templates/common/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": [ 3 | "src/index.html", 4 | "src/.htaccess", 5 | "src/favicon.ico" 6 | ], 7 | "scssIncludePaths": [ 8 | "node_modules/bourbon/app/assets/stylesheets", 9 | "node_modules/bourbon-neat/app/assets/stylesheets" 10 | ], 11 | "cssVendor": [ 12 | "node_modules/normalize.css/normalize.css" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /app/templates/common/gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Windows ### 4 | # Windows image file caches 5 | Thumbs.db 6 | ehthumbs.db 7 | 8 | # Folder config file 9 | Desktop.ini 10 | 11 | # Recycle Bin used on file shares 12 | $RECYCLE.BIN/ 13 | 14 | # Windows Installer files 15 | *.cab 16 | *.msi 17 | *.msm 18 | *.msp 19 | 20 | # Windows shortcuts 21 | *.lnk 22 | 23 | 24 | ### OSX ### 25 | .DS_Store 26 | .AppleDouble 27 | .LSOverride 28 | 29 | # Icon must end with two \r 30 | Icon 31 | 32 | 33 | # Thumbnails 34 | ._* 35 | 36 | # Files that might appear on external disk 37 | .Spotlight-V100 38 | .Trashes 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | 48 | ### Linux ### 49 | *~ 50 | 51 | # KDE directory preferences 52 | .directory 53 | 54 | 55 | ### Sass ### 56 | .sass-cache 57 | 58 | 59 | ### Node ### 60 | # Logs 61 | logs 62 | *.log 63 | 64 | # Runtime data 65 | pids 66 | *.pid 67 | *.seed 68 | 69 | # Directory for instrumented libs generated by jscoverage/JSCover 70 | lib-cov 71 | 72 | # Coverage directory used by tools like istanbul 73 | coverage 74 | 75 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 76 | .grunt 77 | 78 | # node-waf configuration 79 | .lock-wscript 80 | 81 | # Compiled binary addons (http://nodejs.org/api/addons.html) 82 | build/Release 83 | 84 | # Dependency directory 85 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 86 | node_modules 87 | -------------------------------------------------------------------------------- /app/templates/common/gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * 5 | * gulp build - build for development 6 | * gulp watch - build and watch files for change 7 | * gulp - default task [watch] 8 | * gulp build --dist - build for production 9 | * gulp browser-sync - create http server for testing 10 | * gulp data - build json data from 'src/data/' directory 11 | * gulp bump --major - bump major version 12 | * gulp bump --minor - bump minor version 13 | * gulp bump --patch - bump patch version 14 | * 15 | */ 16 | 17 | var del = require('del'), 18 | path = require('path'), 19 | gulp = require('gulp'), 20 | gutil = require('gulp-util'), 21 | concat = require('gulp-concat'), 22 | browserSync = require('browser-sync').create(), 23 | historyApiFallback = require('connect-history-api-fallback'), 24 | uglify = require('gulp-uglify'), 25 | sass = require('gulp-sass'), 26 | sassGlob = require('gulp-sass-glob'), 27 | postcss = require('gulp-postcss'), 28 | assets = require('postcss-assets'), 29 | autoprefixer = require('autoprefixer'), 30 | cssnano = require('cssnano'), 31 | file = require('gulp-file'), 32 | modernizr = require('modernizr'), 33 | sourcemaps = require('gulp-sourcemaps'), 34 | notify = require('gulp-notify'), 35 | notifier = require('node-notifier'), 36 | extend = require('gulp-extend'), 37 | jsonlint = require('gulp-jsonlint'), 38 | minimist = require('minimist'), 39 | gulpif = require('gulp-if'), 40 | runSequence = require('run-sequence'), 41 | eslint = require('gulp-eslint'), 42 | webpack = require('webpack'), 43 | ProgressBarPlugin = require('progress-bar-webpack-plugin'), 44 | bump = require('gulp-bump'), 45 | jeditor = require('gulp-json-editor'), 46 | moment = require('moment'), 47 | modernConfig = require('./modernizr-config.json'), 48 | webpackConfig = require('./webpack.config.js'), 49 | myConfig = Object.create(webpackConfig), 50 | 51 | // get configuration 52 | config = require('./config.json'), 53 | rootFiles = config.root, 54 | scssIncludePaths = config.scssIncludePaths, 55 | cssVendor = config.cssVendor, 56 | 57 | // parse parameters 58 | argv = minimist(process.argv.slice(2), { boolean: true }); 59 | 60 | /** 61 | * 62 | * Build config 63 | * 64 | */ 65 | 66 | var BUILD_DIR = 'website', 67 | AUTO_PREFIXER_RULES = ['last 2 versions']; 68 | 69 | /** 70 | * 71 | * Helper variables 72 | * 73 | */ 74 | 75 | var TASK_NOTIFICATION = false, 76 | LIVE_RELOAD = false, 77 | MODERNIZR_LIB, 78 | BUMP_TYPE; 79 | 80 | /** 81 | * 82 | * Webpack config 83 | * 84 | */ 85 | 86 | myConfig.output = { 87 | path: BUILD_DIR + '/scripts', 88 | publicPath: 'scripts/', 89 | filename: '[name].js', 90 | sourceMapFilename: 'maps/[file].map' 91 | }; 92 | 93 | myConfig.plugins = [ 94 | new ProgressBarPlugin() 95 | ]; 96 | 97 | if (argv.dist) { 98 | myConfig.plugins.push(new webpack.optimize.UglifyJsPlugin()); 99 | } else { 100 | myConfig.debug = true; 101 | myConfig.devtool = '#cheap-module-source-map'; 102 | } 103 | 104 | /** 105 | * 106 | * Server 107 | * 108 | */ 109 | 110 | gulp.task('browser-sync', function () { 111 | browserSync.init({ 112 | server: { 113 | baseDir: './' + BUILD_DIR, 114 | middleware: [historyApiFallback()] 115 | } 116 | }); 117 | }); 118 | 119 | /** 120 | * 121 | * Bump version 122 | * 123 | */ 124 | 125 | gulp.task('bump', function (cb) { 126 | if (argv.major) { 127 | BUMP_TYPE = 'major'; 128 | } else if (argv.minor) { 129 | BUMP_TYPE = 'minor'; 130 | } else if (argv.patch) { 131 | BUMP_TYPE = 'patch'; 132 | } else { 133 | cb(); 134 | gutil.log(gutil.colors.blue('Specify valid semver version type to bump!')); 135 | return; 136 | } 137 | 138 | runSequence('_version-timestamp', '_version-bump', cb); 139 | }); 140 | 141 | gulp.task('_version-timestamp', function () { 142 | return gulp.src('./src/scripts/data/version.json') 143 | .pipe(jeditor({ 'time': moment().format('DD.MM.YYYY HH:mm:ss (ZZ)') })) 144 | .pipe(gulp.dest('./src/scripts/data/')); 145 | }); 146 | 147 | gulp.task('_version-bump', function () { 148 | return gulp.src([ 149 | './package.json', 150 | './src/scripts/data/version.json' 151 | ], { base: './' }) 152 | .pipe(bump({ type: BUMP_TYPE })) 153 | .pipe(gulp.dest('./')); 154 | }); 155 | 156 | /** 157 | * 158 | * Clean task 159 | * 160 | */ 161 | 162 | gulp.task('_clean', function () { 163 | return del([ 164 | BUILD_DIR + '/css/*.*', 165 | BUILD_DIR + '/css/assets/*.*', 166 | BUILD_DIR + '/css/vendor/*.css', 167 | BUILD_DIR + '/css/vendor/*.map', 168 | BUILD_DIR + '/tpls/**', 169 | BUILD_DIR + '/scripts/**' 170 | ], { force: true }); 171 | }); 172 | 173 | /** 174 | * 175 | * Build tasks 176 | * 177 | */ 178 | 179 | // Build main css 180 | gulp.task('_css-build', function () { 181 | return gulp.src('src/scss/**/*.scss') 182 | .pipe(sassGlob()) 183 | .pipe(gulpif(!argv.dist, sourcemaps.init())) 184 | .pipe(sass({ includePaths: scssIncludePaths }) 185 | .on('error', notify.onError('Error: <%= error.message %>'))) 186 | .pipe(gulpif(!argv.dist, postcss([ 187 | assets({ basePath: BUILD_DIR }), 188 | autoprefixer({ browsers: AUTO_PREFIXER_RULES }) 189 | ]) 190 | .on('error', notify.onError('Error: <%= error.message %>')))) 191 | .pipe(gulpif(argv.dist, postcss([ 192 | assets({ basePath: BUILD_DIR }), 193 | autoprefixer({ browsers: AUTO_PREFIXER_RULES }), 194 | cssnano 195 | ]) 196 | .on('error', notify.onError('Error: <%= error.message %>')))) 197 | .pipe(gulpif(!argv.dist, sourcemaps.write('./'))) 198 | .pipe(gulp.dest(BUILD_DIR + '/css/')) 199 | .pipe(gulpif(LIVE_RELOAD, browserSync.stream())) 200 | .pipe(gulpif(TASK_NOTIFICATION, notify({ message: 'CSS build completed.', onLast: true }))); 201 | }); 202 | 203 | // Build vendor css 204 | gulp.task('_css-vendor-build', function () { 205 | return gulp.src(cssVendor) 206 | .pipe(gulpif(!argv.dist, sourcemaps.init())) 207 | .pipe(concat('vendor.css')) 208 | .pipe(gulpif(!argv.dist, postcss([ 209 | autoprefixer({ browsers: AUTO_PREFIXER_RULES }) 210 | ]) 211 | .on('error', notify.onError('Error: <%= error.message %>')))) 212 | .pipe(gulpif(argv.dist, postcss([ 213 | autoprefixer({ browsers: AUTO_PREFIXER_RULES }), 214 | cssnano 215 | ]) 216 | .on('error', notify.onError('Error: <%= error.message %>')))) 217 | .pipe(gulpif(!argv.dist, sourcemaps.write('./'))) 218 | .pipe(gulp.dest(BUILD_DIR + '/css/vendor/')) 219 | .pipe(gulpif(LIVE_RELOAD, browserSync.stream())) 220 | .pipe(gulpif(TASK_NOTIFICATION, notify({ message: 'Vendor CSS build completed.', onLast: true }))); 221 | }); 222 | 223 | // Build js files 224 | var createWebpackCb = function (cb) { 225 | var calledOnce = false; 226 | 227 | var webpackCb = function (err, stats) { 228 | if (err) { 229 | throw new gutil.PluginError('webpack', err); 230 | } 231 | 232 | gutil.log('[webpack]', stats.toString({ chunks: false, colors: true })); 233 | 234 | if (stats.hasErrors()) { 235 | if (!TASK_NOTIFICATION) { 236 | throw new gutil.PluginError('webpack', new Error('JavaScript build error.')); 237 | } else { 238 | notifier.notify({ 239 | title: 'Error running Gulp', 240 | message: 'JavaScript build error.', 241 | icon: path.join(__dirname, 'node_modules', 'gulp-notify', 'assets', 'gulp-error.png'), 242 | sound: 'Frog' 243 | }); 244 | gutil.log( 245 | gutil.colors.cyan('gulp-notify:'), 246 | gutil.colors.blue('[Error running Gulp]'), 247 | gutil.colors.green('JavaScript build error.') 248 | ); 249 | gutil.log( 250 | gutil.colors.white('Finished'), 251 | gutil.colors.cyan('\'_js-watch\''), 252 | gutil.colors.white('after'), 253 | gutil.colors.magenta(stats.toJson().time + ' ms') 254 | ); 255 | } 256 | } else { 257 | if (TASK_NOTIFICATION) { 258 | notifier.notify({ 259 | title: 'Gulp notification', 260 | message: 'JavaScript build completed.', 261 | icon: path.join(__dirname, 'node_modules', 'gulp-notify', 'assets', 'gulp.png') 262 | }); 263 | gutil.log( 264 | gutil.colors.cyan('gulp-notify:'), 265 | gutil.colors.blue('[Gulp notification]'), 266 | gutil.colors.green('JavaScript build completed.') 267 | ); 268 | gutil.log( 269 | gutil.colors.white('Finished'), 270 | gutil.colors.cyan('\'_js-watch\''), 271 | gutil.colors.white('after'), 272 | gutil.colors.magenta(stats.toJson().time + ' ms') 273 | ); 274 | } 275 | 276 | if (LIVE_RELOAD) { 277 | browserSync.reload(); 278 | } 279 | } 280 | 281 | if (!calledOnce) { 282 | calledOnce = true; 283 | cb(); 284 | } 285 | }; 286 | 287 | return function (err, stats) { 288 | runSequence('_js-lint', function () { 289 | webpackCb(err, stats); 290 | }); 291 | }; 292 | }; 293 | 294 | var compiler = webpack(myConfig); 295 | 296 | gulp.task('_js-build', function (cb) { 297 | compiler.run(createWebpackCb(cb)); 298 | }); 299 | 300 | gulp.task('_js-watch', function (cb) { 301 | compiler.watch({}, createWebpackCb(cb)); 302 | }); 303 | 304 | // Build modernizr js 305 | gulp.task('_modernizr-generate', function (cb) { 306 | modernizr.build(modernConfig, function (result) { 307 | MODERNIZR_LIB = result; 308 | 309 | cb(); 310 | }); 311 | }); 312 | 313 | gulp.task('_modernizr-build', ['_modernizr-generate'], function () { 314 | return file('modernizr.js', MODERNIZR_LIB, { src: true }) 315 | .pipe(gulpif(argv.dist, uglify())) 316 | .pipe(gulp.dest(BUILD_DIR + '/scripts/')); 317 | }); 318 | 319 | // Copy templates 320 | gulp.task('_tpls-build', function () { 321 | return gulp.src('src/tpls/**/*.html') 322 | .pipe(gulp.dest(BUILD_DIR + '/tpls/')) 323 | .pipe(gulpif(LIVE_RELOAD, browserSync.stream())) 324 | .pipe(gulpif(TASK_NOTIFICATION, notify({ message: 'Template build completed.', onLast: true }))); 325 | }); 326 | 327 | // Copy root files 328 | gulp.task('_root-files-build', function () { 329 | return gulp.src(rootFiles) 330 | .pipe(gulp.dest(BUILD_DIR + '/')) 331 | .pipe(gulpif(LIVE_RELOAD, browserSync.stream())) 332 | .pipe(gulpif(TASK_NOTIFICATION, notify({ message: 'Root files build completed.', onLast: true }))); 333 | }); 334 | 335 | // Build data 336 | gulp.task('_data-build', function () { 337 | return gulp.src('src/data/**/*.json') 338 | .pipe(jsonlint()) 339 | .pipe(jsonlint.reporter()) 340 | .pipe(jsonlint.failOnError()) 341 | .on('error', notify.onError('JSON data build error.')) 342 | .pipe(extend('data.json')) 343 | .pipe(gulp.dest(BUILD_DIR + '/data/')) 344 | .pipe(gulpif(LIVE_RELOAD, browserSync.stream())) 345 | .pipe(gulpif(TASK_NOTIFICATION, notify({ message: 'Data build completed.', onLast: true }))); 346 | }); 347 | 348 | gulp.task('data', ['_data-build']); 349 | 350 | /** 351 | * 352 | * ESLint task 353 | * 354 | */ 355 | 356 | gulp.task('_js-lint', function () { 357 | return gulp.src(['src/scripts/**/*.js']) 358 | .pipe(eslint()) 359 | .pipe(eslint.format()) 360 | .pipe(eslint.results(function (results) { 361 | if (results.errorCount === 0 && results.warningCount === 0) { 362 | return; 363 | } 364 | 365 | notifier.notify({ 366 | title: 'Error running Gulp', 367 | message: 'JavaScript ESLint error.', 368 | icon: path.join(__dirname, 'node_modules', 'gulp-notify', 'assets', 'gulp-error.png'), 369 | sound: 'Frog' 370 | }); 371 | })); 372 | }); 373 | 374 | /** 375 | * 376 | * Main build task 377 | * 378 | */ 379 | 380 | gulp.task('_build', ['_css-build', '_css-vendor-build', '_tpls-build', '_modernizr-build', 381 | '_root-files-build', '_data-build'], function () { 382 | notifier.notify({ 383 | title: 'Gulp notification', 384 | message: 'Build completed.', 385 | icon: path.join(__dirname, 'node_modules', 'gulp-notify', 'assets', 'gulp.png') 386 | }); 387 | }); 388 | 389 | gulp.task('build', function (cb) { 390 | runSequence('_clean', '_js-build', '_build', cb); 391 | }); 392 | 393 | /** 394 | * 395 | * Watch task 396 | * 397 | */ 398 | 399 | gulp.task('_watch', function () { 400 | gulp.watch('src/scss/**/*.scss', ['_css-build']); 401 | 402 | gulp.watch('src/tpls/**/*.html', ['_tpls-build']); 403 | 404 | gulp.watch(rootFiles, ['_root-files-build']); 405 | 406 | gulp.watch('src/data/**/*.json', ['_data-build']); 407 | }); 408 | 409 | gulp.task('watch', function (cb) { 410 | runSequence('_clean', '_js-watch', '_build', '_watch', 'browser-sync', function () { 411 | TASK_NOTIFICATION = true; 412 | LIVE_RELOAD = true; 413 | 414 | cb(); 415 | }); 416 | }); 417 | 418 | /** 419 | * 420 | * Set DEFAULT task 421 | * 422 | */ 423 | 424 | gulp.task('default', ['watch']); 425 | -------------------------------------------------------------------------------- /app/templates/common/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var webpackConfig = require('./webpack.config'), 4 | webpackKamraConfig = { 5 | devtool: '#inline-source-map', 6 | resolve: webpackConfig.resolve, 7 | module: webpackConfig.module 8 | }; 9 | 10 | module.exports = function (config) { 11 | config.set({ 12 | 13 | // base path that will be used to resolve all patterns (eg. files, exclude) 14 | basePath: './', 15 | 16 | 17 | // frameworks to use 18 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 19 | frameworks: ['jasmine'], 20 | 21 | 22 | // list of files / patterns to load in the browser 23 | files: [ 24 | 'test/unit/_enterSpec.js' 25 | ], 26 | 27 | 28 | // list of files to exclude 29 | exclude: [], 30 | 31 | 32 | // preprocess matching files before serving them to the browser 33 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 34 | preprocessors: { 35 | 'test/unit/_enterSpec.js': ['webpack', 'sourcemap'] 36 | }, 37 | 38 | webpack: webpackKamraConfig, 39 | 40 | 41 | // test results reporter to use 42 | // possible values: 'dots', 'progress' 43 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 44 | reporters: ['spec'], 45 | 46 | 47 | // web server port 48 | port: 9876, 49 | 50 | 51 | // enable / disable colors in the output (reporters and logs) 52 | colors: true, 53 | 54 | 55 | // level of logging 56 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 57 | logLevel: config.LOG_INFO, 58 | 59 | 60 | // enable / disable watching file and executing tests whenever any file changes 61 | autoWatch: true, 62 | 63 | 64 | // start these browsers 65 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 66 | browsers: ['Chrome'], 67 | 68 | 69 | // Continuous Integration mode 70 | // if true, Karma captures browsers, runs the tests and exits 71 | singleRun: false 72 | }); 73 | }; 74 | -------------------------------------------------------------------------------- /app/templates/common/modernizr-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "classPrefix": "", 3 | "options": [ 4 | "setClasses", 5 | "html5shiv" 6 | ], 7 | "feature-detects": [] 8 | } 9 | -------------------------------------------------------------------------------- /app/templates/common/protractor.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.config = { 4 | 5 | baseUrl: 'http://localhost:3000', 6 | 7 | directConnect: true, 8 | 9 | specs: ['test/e2e/spec.js'], 10 | 11 | jasmineNodeOpts: { 12 | // If true, display spec names. 13 | isVerbose: true, 14 | // If true, print colors to the terminal. 15 | showColors: true, 16 | // If true, include stack traces in failures. 17 | includeStackTrace: true, 18 | // Default time to wait in ms before a test fails. 19 | defaultTimeoutInterval: 30000 20 | } 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /app/templates/common/src/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | RewriteEngine On 3 | 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_URI} !^.*\.[a-zA-Z0-9]+$ 6 | RewriteRule ^(.*)$ /index.html [QSA,L,B] 7 | 8 | -------------------------------------------------------------------------------- /app/templates/common/src/assets/README.md: -------------------------------------------------------------------------------- 1 | Don't place assets here. Add assets to /website/assets/ folder. 2 | -------------------------------------------------------------------------------- /app/templates/common/src/data/page-01.json: -------------------------------------------------------------------------------- 1 | { 2 | "page-01": { 3 | 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /app/templates/common/src/data/page-02.json: -------------------------------------------------------------------------------- 1 | { 2 | "page-02": { 3 | 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /app/templates/common/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/src/favicon.ico -------------------------------------------------------------------------------- /app/templates/common/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Project Title 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Incompatible browser
29 | 30 | 31 |
32 | 33 | 34 |
35 |
36 | <% if (pixijs) { %> 37 | <% } %> 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/templates/common/src/scripts/data/app-copy.json: -------------------------------------------------------------------------------- 1 | { 2 | "loader": { 3 | "start": "0%", 4 | "progress": "%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /app/templates/common/src/scripts/data/loader-common.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "id": "app-data", "src": "data/data.json" } 3 | ] 4 | -------------------------------------------------------------------------------- /app/templates/common/src/scripts/data/loader-no-retina.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "id": "plane", "src": "assets/images/plane.png" } 3 | ] 4 | -------------------------------------------------------------------------------- /app/templates/common/src/scripts/data/loader-retina.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "id": "plane", "src": "assets/images/plane_2x.png" } 3 | ] 4 | -------------------------------------------------------------------------------- /app/templates/common/src/scripts/data/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.0.0", 3 | "time": "00.00.0000 00:00:00 (+0000)" 4 | } 5 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/_base.scss: -------------------------------------------------------------------------------- 1 | html { 2 | font-size: 16px; 3 | } 4 | 5 | body { 6 | color: $color-3; 7 | font-family: Arial, Helvetica, sans-serif; 8 | // font-size: 62.5%; // 1em = 10px 9 | } 10 | 11 | a { 12 | color: $color-4; 13 | text-decoration: underline; 14 | cursor: pointer; 15 | } 16 | 17 | a:hover { 18 | color: $color-5; 19 | } 20 | 21 | canvas { 22 | display: block; 23 | } 24 | 25 | // scss-lint:disable ImportantRule, SingleLinePerSelector, SelectorFormat 26 | [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { 27 | display: none !important; 28 | } 29 | // scss-lint:enable ImportantRule, SingleLinePerSelector, SelectorFormat 30 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/_fonts.scss: -------------------------------------------------------------------------------- 1 | @include font-face('generica', '../assets/fonts/generica', $file-formats: eot woff ttf svg); 2 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/_shared.scss: -------------------------------------------------------------------------------- 1 | // variables 2 | 3 | $color-1: #eee; 4 | $color-2: #aaa; 5 | $color-3: #666; 6 | $color-4: #009; 7 | $color-5: #006; 8 | 9 | $retina: 1.5; 10 | 11 | // mixins 12 | 13 | @mixin retina-inline-asset($name, $ext: 'png') { 14 | $image: 'assets/images/' + $name + '.' + $ext; 15 | $image-retina: 'assets/images/' + $name + '_2x.' + $ext; 16 | 17 | display: block; 18 | width: width($image); 19 | height: height($image); 20 | background-repeat: no-repeat; 21 | background-size: size($image); 22 | 23 | @if $assets-retina { 24 | background-image: inline($image-retina); 25 | } @else { 26 | background-image: inline($image); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/assets/_assets.scss: -------------------------------------------------------------------------------- 1 | @import '../shared'; 2 | 3 | .asset-img-1 { 4 | @include retina-inline-asset('IMG-1', 'jpg'); 5 | } 6 | 7 | .asset-img-2 { 8 | @include retina-inline-asset('IMG-2', 'jpg'); 9 | } 10 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/assets/assets-no-retina.scss: -------------------------------------------------------------------------------- 1 | $assets-retina: false; 2 | 3 | @import 'assets'; 4 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/assets/assets-retina.scss: -------------------------------------------------------------------------------- 1 | $assets-retina: true; 2 | 3 | @import 'assets'; 4 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/modules/_animation.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/src/scss/modules/_animation.scss -------------------------------------------------------------------------------- /app/templates/common/src/scss/modules/_canvas.scss: -------------------------------------------------------------------------------- 1 | .canvas-elem { 2 | position: absolute; 3 | top: 0; 4 | left: 0; 5 | z-index: -1; 6 | } 7 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/modules/_incompatible-browser.scss: -------------------------------------------------------------------------------- 1 | // browser is compatible 2 | .incompatible-browser { 3 | display: none; 4 | position: relative; 5 | width: 100%; 6 | text-align: center; 7 | } 8 | 9 | // runtime error - modernizr.js fails (show incompatible browser page) 10 | .no-js .incompatible-browser { 11 | display: block; 12 | } 13 | 14 | // incompatible browser detected (show incompatible browser page) 15 | .incompatible .incompatible-browser { 16 | display: block; 17 | } 18 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/modules/_loader.scss: -------------------------------------------------------------------------------- 1 | .loader { 2 | display: none; 3 | text-align: center; 4 | } 5 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/modules/_version.scss: -------------------------------------------------------------------------------- 1 | .version { 2 | position: fixed; 3 | right: 0; 4 | bottom: 0; 5 | max-width: 100%; 6 | padding: 0.5em; 7 | background: $color-1; 8 | color: $color-3; 9 | font-family: Arial, Helvetica, sans-serif; 10 | // font-size: 1.5em; 11 | opacity: 0.9; 12 | z-index: 9999; 13 | 14 | span { 15 | color: $color-2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/templates/common/src/scss/style.scss: -------------------------------------------------------------------------------- 1 | @import 'bourbon'; 2 | @import 'neat'; 3 | 4 | @import 'shared'; 5 | @import 'base'; 6 | @import 'fonts'; 7 | 8 | @import 'modules/**/*'; 9 | -------------------------------------------------------------------------------- /app/templates/common/src/tpls/partials/footer.html: -------------------------------------------------------------------------------- 1 |
2 | Footer 3 | -------------------------------------------------------------------------------- /app/templates/common/src/tpls/partials/header.html: -------------------------------------------------------------------------------- 1 | Home | 2 | Page 1 3 |

4 | -------------------------------------------------------------------------------- /app/templates/common/src/tpls/views/detail.html: -------------------------------------------------------------------------------- 1 |
2 | Detail page 3 | -------------------------------------------------------------------------------- /app/templates/common/src/tpls/views/home.html: -------------------------------------------------------------------------------- 1 | Home page

2 |
3 | -------------------------------------------------------------------------------- /app/templates/common/src/tpls/views/page1.html: -------------------------------------------------------------------------------- 1 | Page1: Detail

2 |
3 |
4 | -------------------------------------------------------------------------------- /app/templates/common/webpack.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | entry: './src/scripts/main.js', 5 | resolve: { 6 | alias: { 7 | createjs: 'PreloadJS/lib/preloadjs-0.6.2.combined.js'<% if (soundjs) { %>, 8 | SoundJS: 'SoundJS/lib/soundjs-0.6.2.combined.js'<% } %><% if (easeljs) { %>, 9 | EaselJS: 'EaselJS/lib/easeljs-0.8.2.combined.js'<% } %> 10 | } 11 | }<% if (pixijs) { %>, 12 | node: { 13 | fs: 'empty' 14 | }<% } %>, 15 | module: { 16 | loaders: [<% if (es2015) { %> 17 | { test: /\.js$/, exclude: /node_modules/, loader: 'ng-annotate!babel' }<% } else { %> 18 | { test: /\.js$/, exclude: /node_modules/, loader: 'ng-annotate' }<% } %>, 19 | { test: /\.json$/, loader: 'json' }, 20 | { test: /.*gsap.*/, loader: 'imports?gs=>window.GreenSockGlobals={}!exports?gs' }, 21 | { test: /.*PreloadJS.*/, loader: 'imports?this=>global!exports?window.createjs' }<% if (soundjs) { %>, 22 | { test: /.*SoundJS.*/, loader: 'imports?this=>global!exports?window.createjs' }<% } %><% if (easeljs) { %>, 23 | { test: /.*EaselJS.*/, loader: 'imports?this=>global!exports?window.createjs' }<% } %> 24 | ] 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /app/templates/common/website/assets/fonts/generica.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/fonts/generica.eot -------------------------------------------------------------------------------- /app/templates/common/website/assets/fonts/generica.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | -------------------------------------------------------------------------------- /app/templates/common/website/assets/fonts/generica.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/fonts/generica.ttf -------------------------------------------------------------------------------- /app/templates/common/website/assets/fonts/generica.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/fonts/generica.woff -------------------------------------------------------------------------------- /app/templates/common/website/assets/images/IMG-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/images/IMG-1.jpg -------------------------------------------------------------------------------- /app/templates/common/website/assets/images/IMG-1_2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/images/IMG-1_2x.jpg -------------------------------------------------------------------------------- /app/templates/common/website/assets/images/IMG-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/images/IMG-2.jpg -------------------------------------------------------------------------------- /app/templates/common/website/assets/images/IMG-2_2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/images/IMG-2_2x.jpg -------------------------------------------------------------------------------- /app/templates/common/website/assets/images/plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/images/plane.png -------------------------------------------------------------------------------- /app/templates/common/website/assets/images/plane_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarolAltamirano/generator-angular-webpack/d0bf1eab539716f0fa4ada10b8c37a4fe2475c81/app/templates/common/website/assets/images/plane_2x.png -------------------------------------------------------------------------------- /app/templates/es2015/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"] 3 | } 4 | -------------------------------------------------------------------------------- /app/templates/es2015/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "ecmaVersion": 6, 4 | "sourceType": "module" 5 | }, 6 | "rules": { 7 | "no-console": 0, 8 | "no-debugger": 0, 9 | "no-unexpected-multiline": 2, 10 | "indent": [2, 4, { "SwitchCase": 1 }], 11 | "quotes": [2, "single"], 12 | "semi": [2, "always"], 13 | "curly": 2, 14 | "camelcase": [2, {"properties": "always"}], 15 | "eqeqeq": [2, "smart"], 16 | "no-extend-native": 2, 17 | "guard-for-in": 2, 18 | "wrap-iife": [2, "inside"], 19 | "new-cap": 2, 20 | "no-caller": 2, 21 | "no-eval": 2, 22 | "no-use-before-define": 2, 23 | "no-inner-declarations": [2, "both"], 24 | "no-loop-func": 2, 25 | "no-multi-str": 2, 26 | "no-shadow-restricted-names": 2, 27 | "no-shadow": 2, 28 | "new-parens": 2, 29 | "no-invalid-this": 2, 30 | "space-before-function-paren": [2, { "anonymous": "always", "named": "never" }], 31 | "keyword-spacing": 2, 32 | "no-labels": 2, 33 | "block-spacing": [2, "always"], 34 | "space-before-blocks": 2, 35 | "space-infix-ops": 2, 36 | "comma-spacing": [2, { "before": false, "after": true }], 37 | "array-bracket-spacing": [2, "never"], 38 | "space-unary-ops": [1, { "words": true, "nonwords": false }], 39 | "semi-spacing": [2, {"before": false, "after": true}], 40 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 41 | "eol-last": 2, 42 | "spaced-comment": [2, "always"], 43 | "dot-notation": 2, 44 | "no-lone-blocks": 2, 45 | "no-redeclare": 2, 46 | "no-with": 2, 47 | "global-require": 0, 48 | "comma-style": [2, "last"], 49 | "computed-property-spacing": [2, "never"], 50 | "key-spacing": 2, 51 | "newline-after-var": [2, "always"], 52 | "no-array-constructor": 2, 53 | "no-multiple-empty-lines": 2, 54 | "no-spaced-func": 2, 55 | "object-curly-spacing": [2, "always"], 56 | "space-in-parens": [2, "never"], 57 | "arrow-spacing": 2 58 | }, 59 | "env": { 60 | "es6": true, 61 | "node": true, 62 | "browser": true, 63 | "commonjs": true, 64 | "jasmine": true 65 | }, 66 | "extends": "eslint:recommended", 67 | 68 | "globals": {} 69 | } 70 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/animations/_loader.js: -------------------------------------------------------------------------------- 1 | var load = require.context('./', false, /^[^_]+\.js$/); 2 | 3 | load.keys().forEach(load); 4 | 5 | export default 'mAnimations'; 6 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/animations/_mAnimations.js: -------------------------------------------------------------------------------- 1 | import getModuleInstance from '../utilities/getModuleInstance'; 2 | import ngAnimate from 'angular-animate'; 3 | 4 | /** 5 | * Create animations module 6 | */ 7 | 8 | var mAnimations = getModuleInstance('mAnimations', [ngAnimate]); 9 | 10 | export default mAnimations; 11 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/animations/routerAnimation.js: -------------------------------------------------------------------------------- 1 | import mAnimations from './_mAnimations'; 2 | import gsap from 'gsap'; 3 | 4 | mAnimations.animation('.view-change-animate', function () { 5 | return { 6 | enter: function (element, done) { 7 | gsap.TweenMax.set(element, { autoAlpha: 0 }); 8 | gsap.TweenMax.to(element, 1, { autoAlpha: 1, onComplete: done }); 9 | /* 10 | return function (isCancelled) { 11 | if (isCancelled) { 12 | element.remove(); 13 | } 14 | }; 15 | */ 16 | } 17 | /* 18 | , 19 | leave: function (element, done) { 20 | gsap.TweenMax.set(element, { autoAlpha: 1 }); 21 | gsap.TweenMax.to(element, 0.5, { autoAlpha: 0, onComplete: done }); 22 | 23 | return function (isCancelled) { 24 | if (isCancelled) { 25 | element.remove(); 26 | } 27 | }; 28 | } 29 | */ 30 | }; 31 | }); 32 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/controllers/DetailCtrl.js: -------------------------------------------------------------------------------- 1 | import mCtrls from './_mCtrls'; 2 | 3 | mCtrls.controller('DetailCtrl', function () { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/controllers/MyCtrl.js: -------------------------------------------------------------------------------- 1 | import mCtrls from './_mCtrls'; 2 | import debug from 'debug'; 3 | import loader from '../../utilities/loader'; 4 | 5 | var log = debug('Ctrls'); 6 | 7 | mCtrls.controller('MyCtrl', function ($scope) { 8 | log('test'); 9 | $scope.test = 'test'; 10 | console.log(loader.getLoader('main').getResult('app-data')); 11 | }); 12 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/controllers/_loader.js: -------------------------------------------------------------------------------- 1 | var load = require.context('./', false, /^[^_]+\.js$/); 2 | 3 | load.keys().forEach(load); 4 | 5 | export default 'mCtrls'; 6 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/controllers/_mCtrls.js: -------------------------------------------------------------------------------- 1 | import getModuleInstance from '../utilities/getModuleInstance'; 2 | 3 | /** 4 | * Create controllers module 5 | */ 6 | 7 | var mCtrls = getModuleInstance('mCtrls'); 8 | 9 | export default mCtrls; 10 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/directives/_loader.js: -------------------------------------------------------------------------------- 1 | var load = require.context('./', false, /^[^_]+\.js$/); 2 | 3 | load.keys().forEach(load); 4 | 5 | export default 'mDirectives'; 6 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/directives/_mDirectives.js: -------------------------------------------------------------------------------- 1 | import getModuleInstance from '../utilities/getModuleInstance'; 2 | 3 | /** 4 | * Create directives module 5 | */ 6 | 7 | var mDirectives = getModuleInstance('mDirectives'); 8 | 9 | export default mDirectives; 10 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/directives/templateDirective.js: -------------------------------------------------------------------------------- 1 | import mDirectives from './_mDirectives'; 2 | 3 | mDirectives.directive('mdTemplateDirective', function () { 4 | return { 5 | restrict: 'AEC', 6 | template: '', 7 | link: function (scope, element) { 8 | element; 9 | } 10 | }; 11 | }); 12 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/mApp.js: -------------------------------------------------------------------------------- 1 | import angular from 'angular'; 2 | import ngTouch from 'angular-touch'; 3 | import ngSanitize from 'angular-sanitize'; 4 | import uiRouter from 'angular-ui-router'; 5 | import mAnimations from './animations/_loader'; 6 | import mCtrls from './controllers/_loader'; 7 | import mDirectives from './directives/_loader'; 8 | import mServices from './services/_loader'; 9 | 10 | <% if (pixijs) { %> 11 | import Canvas from '../canvas/Canvas'; 12 | <% } %> 13 | /** 14 | * Register main angular app 15 | */ 16 | angular.module('mApp', [ngTouch, ngSanitize, uiRouter, mAnimations, mCtrls, mDirectives, mServices]) 17 | .config(function ($stateProvider, $locationProvider, $urlRouterProvider) { 18 | 'ngInject'; 19 | 20 | $stateProvider 21 | .state('home', { 22 | url: '/', 23 | templateUrl: 'tpls/views/home.html', 24 | controller: 'MyCtrl' 25 | }) 26 | .state('page1', { 27 | url: '/page1', 28 | templateUrl: 'tpls/views/page1.html', 29 | controller: 'MyCtrl' 30 | }) 31 | .state('page1.detail', { 32 | url: '/detail', 33 | templateUrl: 'tpls/views/detail.html', 34 | controller: 'DetailCtrl' 35 | }); 36 | 37 | $urlRouterProvider.otherwise('/'); 38 | 39 | $locationProvider.html5Mode(true); 40 | })<% if (pixijs) { %> 41 | .run(function () { 42 | new Canvas('canvas-elem'); 43 | });<% } else { %>;<% } %> 44 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/services/_loader.js: -------------------------------------------------------------------------------- 1 | var load = require.context('./', false, /^[^_]+\.js$/); 2 | 3 | load.keys().forEach(load); 4 | 5 | export default 'mServices'; 6 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/services/_mServices.js: -------------------------------------------------------------------------------- 1 | import getModuleInstance from '../utilities/getModuleInstance'; 2 | 3 | /** 4 | * Create services module 5 | */ 6 | 7 | var mServices = getModuleInstance('mServices'); 8 | 9 | export default mServices; 10 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/services/templateFactory.js: -------------------------------------------------------------------------------- 1 | import mServices from './_mServices'; 2 | 3 | mServices.factory('templateFactory', function () { 4 | return { 5 | 6 | }; 7 | }); 8 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/app/utilities/getModuleInstance.js: -------------------------------------------------------------------------------- 1 | import angular from 'angular'; 2 | 3 | var _modules = {}; 4 | 5 | /** 6 | * Get instance of angular module. If module doesn't exist create one. 7 | * 8 | * @param {string} moduleId - name of the module 9 | * @return {object} - angular module 10 | */ 11 | var getModuleInstance = function (moduleId, dependencies) { 12 | if (typeof moduleId !== 'string') { 13 | throw new Error('ModuleId should be a string'); 14 | } 15 | 16 | if (dependencies != null && Object.prototype.toString.call(dependencies) !== '[object Array]') { 17 | throw new Error('Dependencies should be an Array'); 18 | } 19 | 20 | dependencies = dependencies || []; 21 | 22 | if (_modules[moduleId] == null) { 23 | _modules[moduleId] = angular.module(moduleId, dependencies); 24 | } 25 | 26 | return _modules[moduleId]; 27 | }; 28 | 29 | export default getModuleInstance; 30 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/canvas/Canvas.js: -------------------------------------------------------------------------------- 1 | import PIXI from 'pixi.js'; 2 | import Plane from './Plane'; 3 | 4 | /** 5 | * Canvas class - Create canvas 6 | * 7 | * @param {string} canvas - Id of html element 8 | */ 9 | export default class Canvas { 10 | constructor(canvas) { 11 | var scale = window.devicePixelRatio || 1, 12 | canvasElement = document.getElementById(canvas); 13 | 14 | this.width = window.innerWidth; 15 | this.height = window.innerHeight; 16 | 17 | canvasElement.style.width = this.width + 'px'; 18 | canvasElement.style.height = this.height + 'px'; 19 | 20 | this.container = new PIXI.Container(); 21 | 22 | this.renderer = PIXI.autoDetectRenderer(this.width, this.height, { 23 | view: canvasElement, 24 | resolution: scale 25 | }); 26 | 27 | this.renderer.backgroundColor = 0xFFFFFF; 28 | 29 | this.createElements(); 30 | 31 | // register on resize callback 32 | this.onResize(); 33 | 34 | // run animation 35 | requestAnimationFrame(() => { 36 | this.animate(); 37 | }); 38 | } 39 | 40 | /** 41 | * Create canvas objects 42 | */ 43 | createElements() { 44 | this.spritePlane = new Plane(this.renderer.resolution); 45 | this.spritePlane.position.x = this.width / 2; 46 | this.spritePlane.position.y = this.height / 2; 47 | 48 | this.container.addChild(this.spritePlane); 49 | } 50 | 51 | /** 52 | * Canvas animation loop 53 | */ 54 | animate() { 55 | requestAnimationFrame(() => { 56 | this.animate(); 57 | }); 58 | 59 | this.renderer.render(this.container); 60 | } 61 | 62 | /** 63 | * Handle canvas resize 64 | */ 65 | onResize() { 66 | window.addEventListener('resize', () => { 67 | // resize renderer 68 | this.width = window.innerWidth; 69 | this.height = window.innerHeight; 70 | 71 | this.renderer.view.style.width = this.width + 'px'; 72 | this.renderer.view.style.height = this.height + 'px'; 73 | 74 | this.renderer.resize(this.width, this.height); 75 | 76 | this.positionElementsOnResize(); 77 | }); 78 | } 79 | 80 | /** 81 | * Position objects on canvas resize 82 | */ 83 | positionElementsOnResize() { 84 | this.spritePlane.position.x = this.width / 2; 85 | this.spritePlane.position.y = this.height / 2; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/canvas/Plane.js: -------------------------------------------------------------------------------- 1 | import PIXI from 'pixi.js'; 2 | import loader from '../utilities/loader'; 3 | 4 | /** 5 | * Plane class - Create plane object 6 | * 7 | * @param {number} resolution - Device Pixel Ratio 8 | */ 9 | export default class Plane extends PIXI.Sprite { 10 | constructor(resolution) { 11 | var planeImg = loader.getLoader('main').getResult('plane'), 12 | planeBase = new PIXI.BaseTexture(planeImg), 13 | planeTexture = new PIXI.Texture(planeBase), 14 | scale = resolution > 1 ? 0.5 : 1; 15 | 16 | super(planeTexture); 17 | 18 | this.scale = new PIXI.Point(scale, scale); 19 | this.anchor.x = 0.5; 20 | this.anchor.y = 0.5; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/main.js: -------------------------------------------------------------------------------- 1 | import incompDetect from './utilities/incompDetect'; 2 | 3 | // run browser detection 4 | incompDetect(); 5 | 6 | import 'babel-polyfill'; 7 | import loader from './utilities/loader'; 8 | import version from './utilities/version'; 9 | import incompatible from './utilities/incompatible'; 10 | import appCopy from './data/app-copy.json'; 11 | 12 | // render build version if enabled 13 | version(); 14 | 15 | // set loader callbacks 16 | function progressCb(e) { 17 | var p = Math.round(100 * e.progress); 18 | 19 | // show progress in loader 20 | document.querySelector('.loader').innerHTML = p + appCopy.loader.progress; 21 | } 22 | 23 | function completeCb() { 24 | // create new chunk 25 | require.ensure([], function (require) { 26 | var angular = require('angular'); 27 | 28 | require('./app/mApp'); 29 | 30 | // hide loader 31 | document.querySelector('.loader').style.display = 'none'; 32 | 33 | // run app 34 | angular.bootstrap(document, ['mApp'], { strictDi: true }); 35 | }); 36 | } 37 | 38 | // bootstrap application 39 | if (!incompatible.isIncompatibleBrowser()) { 40 | // show loader 41 | document.querySelector('.loader').innerHTML = appCopy.loader.start; 42 | document.querySelector('.loader').style.display = 'block'; 43 | 44 | // start loader 45 | loader.createLoader('main', progressCb, completeCb); 46 | } 47 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/utilities/appSettings.js: -------------------------------------------------------------------------------- 1 | var appSettings = {}; 2 | 3 | /** 4 | * Helper method for detecting production enviroment 5 | * 6 | * @return {Boolean} - 'true' for production enviroment, 'false' for development 7 | */ 8 | appSettings.isProduction = function () { 9 | var host = window.location.hostname; 10 | 11 | if (host === 'localhost') { 12 | return false; 13 | } 14 | 15 | return true; 16 | }; 17 | 18 | /** 19 | * Helper method for detecting development enviroment 20 | * 21 | * @return {Boolean} - 'false' for production enviroment, 'true' for development 22 | */ 23 | appSettings.isNotProduction = function () { 24 | return !appSettings.isProduction(); 25 | }; 26 | 27 | /** 28 | * Print version info on the page 29 | * 30 | * @type {Boolean} 31 | */ 32 | appSettings.renderVersionInfo = true; 33 | 34 | export default appSettings; 35 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/utilities/incompDetect.js: -------------------------------------------------------------------------------- 1 | import incompatible from './incompatible'; 2 | 3 | /** 4 | * Add 'incompatible' class to documentElement in unsupported browsers 5 | */ 6 | var incompDetect = function () { 7 | if (incompatible.isIncompatibleBrowser()) { 8 | // if browser is incompatible 9 | document.documentElement.className = 'incompatible ' + document.documentElement.className; 10 | } 11 | }; 12 | 13 | export default incompDetect; 14 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/utilities/incompatible.js: -------------------------------------------------------------------------------- 1 | /* eslint key-spacing: 0, comma-spacing: 0 */ 2 | 3 | import UAParser from 'ua-parser-js'; 4 | 5 | var uaParser = new UAParser(), 6 | incompatible = {}; 7 | 8 | incompatible.uaResult = uaParser.getResult(); 9 | 10 | /** 11 | * Check browser compatibility 12 | * 13 | * @return {Boolean} - for uncompatible browser return 'true', otherwise 'false' 14 | */ 15 | incompatible.isIncompatibleBrowser = function () { 16 | var listOfSupported = [ 17 | { browser: 'Chrome' , version: 43 }, 18 | { browser: 'Firefox' , version: 38 }, 19 | { browser: 'Safari' , version: 7 }, 20 | { browser: 'Mobile Safari', version: 7 }, 21 | { browser: 'IE' , version: 11 }, 22 | { browser: 'Edge' , version: 12 }, 23 | { browser: 'IEMobile' , version: 11 } 24 | ], 25 | incomp = true, 26 | i; 27 | 28 | for (i = 0; i < listOfSupported.length; i++) { 29 | if (listOfSupported[i].browser === incompatible.uaResult.browser.name && 30 | listOfSupported[i].version <= parseInt(incompatible.uaResult.browser.major)) { 31 | incomp = false; 32 | } 33 | } 34 | 35 | return incomp; 36 | }; 37 | 38 | export default incompatible; 39 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/utilities/loader.js: -------------------------------------------------------------------------------- 1 | import createjs from 'createjs'; 2 | import loaderData from './loaderData'; 3 | 4 | var _loader = {}; 5 | <% if (soundjs) { %> 6 | // initialize SoundJS - use 'createjs' object to work with 'SoundJS' 7 | import 'SoundJS'; 8 | <% } %><% if (easeljs) { %> 9 | // initialize EaselJS - use 'createjs' object to work with 'EaselJS' 10 | import 'EaselJS'; 11 | <% } %> 12 | /** 13 | * Create loader 14 | * 15 | * @param {string} id - id of new loader 16 | * @param {function} progressCb - callback function during loading 17 | * @param {function} completeCb - callback function when loading is completed 18 | */ 19 | var createLoader = function (id, progressCb, completeCb) { 20 | if (_loader[id] != null) { 21 | throw new Error('Loader with id: ' + id + ' already exists.'); 22 | } 23 | 24 | _loader[id] = new createjs.LoadQueue(true); 25 | <% if (soundjs) { %> 26 | createjs.Sound.alternateExtensions = ['mp3']; 27 | _loader[id].installPlugin(createjs.Sound); 28 | <% } %> 29 | _loader[id].addEventListener('progress', progressCb); 30 | _loader[id].addEventListener('complete', completeCb); 31 | 32 | _loader[id].loadManifest(loaderData); 33 | }; 34 | 35 | /** 36 | * Create spy loader for unit tests 37 | * 38 | * @param {string} id - id of a loaderData 39 | * @param {string} value - return value of the new loaderData 40 | */ 41 | var createSpyLoader = function (id, value) { 42 | if (_loader[id] != null) { 43 | throw new Error('Loader with id: ' + id + ' already exists.'); 44 | } 45 | 46 | _loader[id] = { 47 | getResult: function () { return value; } 48 | }; 49 | }; 50 | 51 | /** 52 | * Get loader by its id 53 | * 54 | * @param {string} id - id of a loaderData 55 | */ 56 | var getLoader = function (id) { 57 | if (_loader[id] == null) { 58 | throw new Error('Loader with id: ' + id + ' does not exist.'); 59 | } 60 | 61 | return _loader[id]; 62 | }; 63 | 64 | export default { 65 | createLoader: createLoader, 66 | createSpyLoader: createSpyLoader, 67 | getLoader: getLoader 68 | }; 69 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/utilities/loaderData.js: -------------------------------------------------------------------------------- 1 | import dataCommon from '../data/loader-common.json'; 2 | import dataNoRetina from '../data/loader-no-retina.json'; 3 | import dataRetina from '../data/loader-retina.json'; 4 | 5 | var isRetina = window.devicePixelRatio > 1, 6 | data; 7 | 8 | if (isRetina) { 9 | data = dataCommon.concat(dataRetina); 10 | data.push({ id: 'assets-css', src: 'css/assets/assets-retina.css' }); 11 | } else { 12 | data = dataCommon.concat(dataNoRetina); 13 | data.push({ id: 'assets-css', src: 'css/assets/assets-no-retina.css' }); 14 | } 15 | 16 | export default data; 17 | -------------------------------------------------------------------------------- /app/templates/es2015/src/scripts/utilities/version.js: -------------------------------------------------------------------------------- 1 | import versionJson from '../data/version.json'; 2 | import appSettings from './appSettings'; 3 | 4 | /** 5 | * Print version info 6 | */ 7 | var version = function () { 8 | var el; 9 | 10 | if (!appSettings.renderVersionInfo) { 11 | return; 12 | } 13 | 14 | // print version to console 15 | if (console && console.log) { 16 | console.log( 17 | '\n%cv' + versionJson.version + '%c %c' + versionJson.time + '%c\n\n', 18 | 'color: #ffffff; background: #00aa00; padding: 1px 5px;', 19 | 'color: #ffffff; background: #d1eeee; padding: 1px 5px;', 20 | 'color: #ffffff; background: #00aa00; padding: 1px 5px;', 21 | 'background: #ffffff;' 22 | ); 23 | } 24 | 25 | // print version to page 26 | el = document.createElement('div'); 27 | el.className = 'version'; 28 | el.innerHTML = ( 29 | '
' + 30 | 'v' + versionJson.version + ' | ' + versionJson.time + '' + 31 | '
' 32 | ); 33 | 34 | document.body.appendChild(el); 35 | }; 36 | 37 | export default version; 38 | -------------------------------------------------------------------------------- /app/templates/es2015/test/e2e/spec.js: -------------------------------------------------------------------------------- 1 | /* eslint-env protractor */ 2 | 3 | 'use strict'; 4 | 5 | describe('HOME PAGE', function () { 6 | beforeEach(function () { 7 | browser.get(''); 8 | }); 9 | 10 | it('Should have title', function () { 11 | expect(browser.getTitle()).toEqual(jasmine.any(String)); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /app/templates/es2015/test/unit/_enterSpec.js: -------------------------------------------------------------------------------- 1 | import 'angular'; 2 | import 'angular-mocks'; 3 | 4 | import './controllersSpec'; 5 | import './directivesSpec'; 6 | import './filtersSpec'; 7 | import './servicesSpec'; 8 | -------------------------------------------------------------------------------- /app/templates/es2015/test/unit/controllersSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | import angular from 'angular'; 4 | import mCtrls from '../../src/scripts/app/controllers/_loader'; 5 | import loader from '../../src/scripts/utilities/loader'; 6 | 7 | describe('Controllers', function () { 8 | 9 | loader.createSpyLoader('main', 'spy loader data'); 10 | 11 | describe('MyCtrl', function () { 12 | var $scope; 13 | 14 | beforeEach(angular.mock.module(mCtrls)); 15 | 16 | beforeEach(inject(function ($rootScope, $controller) { 17 | $scope = $rootScope.$new(); 18 | $controller('MyCtrl', { $scope: $scope }); 19 | })); 20 | 21 | it('Placeholder', function () { 22 | expect($scope.test).toBe('test'); 23 | }); 24 | 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /app/templates/es2015/test/unit/directivesSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | describe('Directives', function () { 4 | 5 | var $compile, 6 | $rootScope; 7 | 8 | // beforeEach(angular.mock.module('mDirectives')); 9 | 10 | beforeEach(inject(function (_$compile_, _$rootScope_) { 11 | $compile = _$compile_; 12 | $rootScope = _$rootScope_; 13 | })); 14 | 15 | it('Placeholder', function () { 16 | var scope = $rootScope.$new(), 17 | element; 18 | 19 | scope.variable = 'Hello World'; 20 | element = $compile('
')(scope); 21 | scope.$digest(); 22 | 23 | expect(element.html()).toContain('Hello World'); 24 | }); 25 | 26 | }); 27 | -------------------------------------------------------------------------------- /app/templates/es2015/test/unit/filtersSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | /* 4 | describe('Filters', function () { 5 | describe('', function() { 6 | beforeEach(angular.mock.module('')); 7 | it('', inject(function (nameFilter) { 8 | expect(nameFilter('argv')).toEqual(0); 9 | })); 10 | }); 11 | }); 12 | */ 13 | -------------------------------------------------------------------------------- /app/templates/es2015/test/unit/servicesSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | /* 4 | describe('Services', function () { 5 | var service; 6 | 7 | beforeEach(angular.mock.module('mServices')); 8 | 9 | beforeEach(inject(function (_service_) { 10 | service = _service_; 11 | })); 12 | 13 | it('check if `service` exists', function () { 14 | expect(service).toBeDefined(); 15 | }); 16 | 17 | }); 18 | */ 19 | -------------------------------------------------------------------------------- /app/templates/es5/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "ecmaVersion": 5 4 | }, 5 | "rules": { 6 | "no-console": 0, 7 | "no-debugger": 0, 8 | "no-unexpected-multiline": 2, 9 | "indent": [2, 4, { "SwitchCase": 1 }], 10 | "quotes": [2, "single"], 11 | "semi": [2, "always"], 12 | "strict": 2, 13 | "curly": 2, 14 | "camelcase": [2, {"properties": "always"}], 15 | "eqeqeq": [2, "smart"], 16 | "no-extend-native": 2, 17 | "guard-for-in": 2, 18 | "wrap-iife": [2, "inside"], 19 | "new-cap": 2, 20 | "no-caller": 2, 21 | "no-eval": 2, 22 | "no-use-before-define": 2, 23 | "no-inner-declarations": [2, "both"], 24 | "no-loop-func": 2, 25 | "no-multi-str": 2, 26 | "no-shadow-restricted-names": 2, 27 | "no-shadow": 2, 28 | "new-parens": 2, 29 | "no-invalid-this": 2, 30 | "space-before-function-paren": [2, { "anonymous": "always", "named": "never" }], 31 | "keyword-spacing": 2, 32 | "no-labels": 2, 33 | "block-spacing": [2, "always"], 34 | "space-before-blocks": 2, 35 | "space-infix-ops": 2, 36 | "comma-spacing": [2, { "before": false, "after": true }], 37 | "array-bracket-spacing": [2, "never"], 38 | "space-unary-ops": [1, { "words": true, "nonwords": false }], 39 | "semi-spacing": [2, {"before": false, "after": true}], 40 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 41 | "eol-last": 2, 42 | "spaced-comment": [2, "always"], 43 | "dot-notation": 2, 44 | "no-lone-blocks": 2, 45 | "no-redeclare": 2, 46 | "no-with": 2, 47 | "global-require": 0, 48 | "comma-style": [2, "last"], 49 | "computed-property-spacing": [2, "never"], 50 | "key-spacing": 2, 51 | "newline-after-var": [2, "always"], 52 | "no-array-constructor": 2, 53 | "no-multiple-empty-lines": 2, 54 | "no-spaced-func": 2, 55 | "object-curly-spacing": [2, "always"], 56 | "space-in-parens": [2, "never"], 57 | "arrow-spacing": 2 58 | }, 59 | "env": { 60 | "es6": true, 61 | "node": true, 62 | "browser": true, 63 | "commonjs": true, 64 | "jasmine": true 65 | }, 66 | "extends": "eslint:recommended", 67 | 68 | "globals": {} 69 | } 70 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/animations/_loader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var load = require.context('./', false, /^[^_]+\.js$/); 4 | 5 | load.keys().forEach(load); 6 | 7 | module.exports = 'mAnimations'; 8 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/animations/_mAnimations.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Create animations module 5 | */ 6 | 7 | var getModuleInstance = require('../utilities/getModuleInstance'), 8 | ngAnimate = require('angular-animate'); 9 | 10 | var mAnimations = getModuleInstance('mAnimations', [ngAnimate]); 11 | 12 | module.exports = mAnimations; 13 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/animations/routerAnimation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var mAnimations = require('./_mAnimations'), 4 | gsap = require('gsap'); 5 | 6 | mAnimations.animation('.view-change-animate', function () { 7 | return { 8 | enter: function (element, done) { 9 | gsap.TweenMax.set(element, { autoAlpha: 0 }); 10 | gsap.TweenMax.to(element, 1, { autoAlpha: 1, onComplete: done }); 11 | /* 12 | return function (isCancelled) { 13 | if (isCancelled) { 14 | element.remove(); 15 | } 16 | }; 17 | */ 18 | } 19 | /* 20 | , 21 | leave: function (element, done) { 22 | gsap.TweenMax.set(element, { autoAlpha: 1 }); 23 | gsap.TweenMax.to(element, 0.5, { autoAlpha: 0, onComplete: done }); 24 | 25 | return function (isCancelled) { 26 | if (isCancelled) { 27 | element.remove(); 28 | } 29 | }; 30 | } 31 | */ 32 | }; 33 | }); 34 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/controllers/DetailCtrl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var mCtrls = require('./_mCtrls'); 4 | 5 | mCtrls.controller('DetailCtrl', function () { 6 | 7 | }); 8 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/controllers/MyCtrl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var mCtrls = require('./_mCtrls'), 4 | debug = require('debug'), 5 | log = debug('Ctrls'), 6 | loader = require('../../utilities/loader'); 7 | 8 | mCtrls.controller('MyCtrl', function ($scope) { 9 | log('test'); 10 | $scope.test = 'test'; 11 | console.log(loader.getLoader('main').getResult('app-data')); 12 | }); 13 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/controllers/_loader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var load = require.context('./', false, /^[^_]+\.js$/); 4 | 5 | load.keys().forEach(load); 6 | 7 | module.exports = 'mCtrls'; 8 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/controllers/_mCtrls.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Create controllers module 5 | */ 6 | 7 | var getModuleInstance = require('../utilities/getModuleInstance'); 8 | 9 | var mCtrls = getModuleInstance('mCtrls'); 10 | 11 | module.exports = mCtrls; 12 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/directives/_loader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var load = require.context('./', false, /^[^_]+\.js$/); 4 | 5 | load.keys().forEach(load); 6 | 7 | module.exports = 'mDirectives'; 8 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/directives/_mDirectives.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Create directives module 5 | */ 6 | 7 | var getModuleInstance = require('../utilities/getModuleInstance'); 8 | 9 | var mDirectives = getModuleInstance('mDirectives'); 10 | 11 | module.exports = mDirectives; 12 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/directives/templateDirective.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var mDirectives = require('./_mDirectives'); 4 | 5 | mDirectives.directive('mdTemplateDirective', function () { 6 | return { 7 | restrict: 'AEC', 8 | template: '', 9 | link: function (scope, element) { 10 | element; 11 | } 12 | }; 13 | }); 14 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/mApp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var angular = require('angular'), 4 | ngTouch = require('angular-touch'), 5 | ngSanitize = require('angular-sanitize'), 6 | uiRouter = require('angular-ui-router'), 7 | mAnimations = require('./animations/_loader'), 8 | mCtrls = require('./controllers/_loader'), 9 | mDirectives = require('./directives/_loader'), 10 | mServices = require('./services/_loader'); 11 | 12 | <% if (pixijs) { %> 13 | var Canvas = require('../canvas/Canvas'); 14 | <% } %> 15 | /** 16 | * Register main angular app 17 | */ 18 | angular.module('mApp', [ngTouch, ngSanitize, uiRouter, mAnimations, mCtrls, mDirectives, mServices]) 19 | .config(function ($stateProvider, $locationProvider, $urlRouterProvider) { 20 | 'ngInject'; 21 | 22 | $stateProvider 23 | .state('home', { 24 | url: '/', 25 | templateUrl: 'tpls/views/home.html', 26 | controller: 'MyCtrl' 27 | }) 28 | .state('page1', { 29 | url: '/page1', 30 | templateUrl: 'tpls/views/page1.html', 31 | controller: 'MyCtrl' 32 | }) 33 | .state('page1.detail', { 34 | url: '/detail', 35 | templateUrl: 'tpls/views/detail.html', 36 | controller: 'DetailCtrl' 37 | }); 38 | 39 | $urlRouterProvider.otherwise('/'); 40 | 41 | $locationProvider.html5Mode(true); 42 | })<% if (pixijs) { %> 43 | .run(function () { 44 | new Canvas('canvas-elem'); 45 | });<% } else { %>;<% } %> 46 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/services/_loader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var load = require.context('./', false, /^[^_]+\.js$/); 4 | 5 | load.keys().forEach(load); 6 | 7 | module.exports = 'mServices'; 8 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/services/_mServices.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Create services module 5 | */ 6 | 7 | var getModuleInstance = require('../utilities/getModuleInstance'); 8 | 9 | var mServices = getModuleInstance('mServices'); 10 | 11 | module.exports = mServices; 12 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/services/templateFactory.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var mServices = require('./_mServices'); 4 | 5 | mServices.factory('templateFactory', function () { 6 | return { 7 | 8 | }; 9 | }); 10 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/app/utilities/getModuleInstance.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var angular = require('angular'), 4 | _modules = {}; 5 | 6 | /** 7 | * Get instance of angular module. If module doesn't exist create one. 8 | * 9 | * @param {string} moduleId - name of the module 10 | * @return {object} - angular module 11 | */ 12 | var getModuleInstance = function (moduleId, dependencies) { 13 | if (typeof moduleId !== 'string') { 14 | throw new Error('ModuleId should be a string'); 15 | } 16 | 17 | if (dependencies != null && Object.prototype.toString.call(dependencies) !== '[object Array]') { 18 | throw new Error('Dependencies should be an Array'); 19 | } 20 | 21 | dependencies = dependencies || []; 22 | 23 | if (_modules[moduleId] == null) { 24 | _modules[moduleId] = angular.module(moduleId, dependencies); 25 | } 26 | 27 | return _modules[moduleId]; 28 | }; 29 | 30 | module.exports = getModuleInstance; 31 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/canvas/Canvas.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var PIXI = require('pixi.js'), 4 | Plane = require('./Plane'); 5 | 6 | /** 7 | * Canvas class - Create canvas 8 | * 9 | * @param {string} canvas - Id of html element 10 | */ 11 | function Canvas(canvas) { 12 | var scale = window.devicePixelRatio || 1, 13 | canvasElement = document.getElementById(canvas), 14 | _this = this; 15 | 16 | this.width = window.innerWidth; 17 | this.height = window.innerHeight; 18 | 19 | canvasElement.style.width = this.width + 'px'; 20 | canvasElement.style.height = this.height + 'px'; 21 | 22 | this.container = new PIXI.Container(); 23 | 24 | this.renderer = PIXI.autoDetectRenderer(this.width, this.height, { 25 | view: canvasElement, 26 | resolution: scale 27 | }); 28 | 29 | this.renderer.backgroundColor = 0xFFFFFF; 30 | 31 | this.createElements(); 32 | 33 | // register on resize callback 34 | this.onResize(); 35 | 36 | // run animation 37 | requestAnimationFrame(function () { 38 | _this.animate(); 39 | }); 40 | } 41 | 42 | /** 43 | * Create canvas objects 44 | */ 45 | Canvas.prototype.createElements = function () { 46 | this.spritePlane = new Plane(this.renderer.resolution); 47 | this.spritePlane.position.x = this.width / 2; 48 | this.spritePlane.position.y = this.height / 2; 49 | 50 | this.container.addChild(this.spritePlane); 51 | }; 52 | 53 | /** 54 | * Canvas animation loop 55 | */ 56 | Canvas.prototype.animate = function () { 57 | var _this = this; 58 | 59 | requestAnimationFrame(function () { 60 | _this.animate(); 61 | }); 62 | 63 | this.renderer.render(this.container); 64 | }; 65 | 66 | /** 67 | * Handle canvas resize 68 | */ 69 | Canvas.prototype.onResize = function () { 70 | window.addEventListener('resize', function () { 71 | // resize renderer 72 | this.width = window.innerWidth; 73 | this.height = window.innerHeight; 74 | 75 | this.renderer.view.style.width = this.width + 'px'; 76 | this.renderer.view.style.height = this.height + 'px'; 77 | 78 | this.renderer.resize(this.width, this.height); 79 | 80 | this.positionElementsOnResize(); 81 | }.bind(this)); 82 | }; 83 | 84 | /** 85 | * Position objects on canvas resize 86 | */ 87 | Canvas.prototype.positionElementsOnResize = function () { 88 | this.spritePlane.position.x = this.width / 2; 89 | this.spritePlane.position.y = this.height / 2; 90 | }; 91 | 92 | module.exports = Canvas; 93 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/canvas/Plane.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var PIXI = require('pixi.js'), 4 | loader = require('../utilities/loader'); 5 | 6 | /** 7 | * Plane class - Create plane object 8 | * 9 | * @param {number} resolution - Device Pixel Ratio 10 | */ 11 | function Plane(resolution) { 12 | var planeImg = loader.getLoader('main').getResult('plane'), 13 | planeBase = new PIXI.BaseTexture(planeImg), 14 | planeTexture = new PIXI.Texture(planeBase), 15 | scale = resolution > 1 ? 0.5 : 1; 16 | 17 | PIXI.Sprite.call(this, planeTexture); 18 | 19 | this.scale = new PIXI.Point(scale, scale); 20 | this.anchor.x = 0.5; 21 | this.anchor.y = 0.5; 22 | } 23 | 24 | Plane.prototype = Object.create(PIXI.Sprite.prototype); 25 | Plane.prototype.constructor = Plane; 26 | 27 | module.exports = Plane; 28 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var incompDetect = require('./utilities/incompDetect'); 4 | 5 | // run browser detection 6 | incompDetect(); 7 | 8 | var loader = require('./utilities/loader'), 9 | version = require('./utilities/version'), 10 | incompatible = require('./utilities/incompatible'), 11 | appCopy = require('./data/app-copy.json'); 12 | 13 | // render build version if enabled 14 | version(); 15 | 16 | // set loader callbacks 17 | function progressCb(e) { 18 | var p = Math.round(100 * e.progress); 19 | 20 | // show progress in loader 21 | document.querySelector('.loader').innerHTML = p + appCopy.loader.progress; 22 | } 23 | 24 | function completeCb() { 25 | // create new chunk 26 | require.ensure([], function (require) { 27 | var angular = require('angular'); 28 | 29 | require('./app/mApp'); 30 | 31 | // hide loader 32 | document.querySelector('.loader').style.display = 'none'; 33 | 34 | // run app 35 | angular.bootstrap(document, ['mApp'], { strictDi: true }); 36 | }); 37 | } 38 | 39 | // bootstrap application 40 | 41 | if (!incompatible.isIncompatibleBrowser()) { 42 | // show loader 43 | document.querySelector('.loader').innerHTML = appCopy.loader.start; 44 | document.querySelector('.loader').style.display = 'block'; 45 | 46 | // start loader 47 | loader.createLoader('main', progressCb, completeCb); 48 | } 49 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/utilities/appSettings.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var appSettings = {}; 4 | 5 | /** 6 | * Helper method for detecting production enviroment 7 | * 8 | * @return {Boolean} - 'true' for production enviroment, 'false' for development 9 | */ 10 | appSettings.isProduction = function () { 11 | var host = window.location.hostname; 12 | 13 | if (host === 'localhost') { 14 | return false; 15 | } 16 | 17 | return true; 18 | }; 19 | 20 | /** 21 | * Helper method for detecting development enviroment 22 | * 23 | * @return {Boolean} - 'false' for production enviroment, 'true' for development 24 | */ 25 | appSettings.isNotProduction = function () { 26 | return !appSettings.isProduction(); 27 | }; 28 | 29 | /** 30 | * Print version info on the page 31 | * 32 | * @type {Boolean} 33 | */ 34 | appSettings.renderVersionInfo = true; 35 | 36 | module.exports = appSettings; 37 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/utilities/incompDetect.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var incompatible = require('./incompatible'); 4 | 5 | /** 6 | * Add 'incompatible' class to documentElement in unsupported browsers 7 | */ 8 | var incompDetect = function () { 9 | if (incompatible.isIncompatibleBrowser()) { 10 | // if browser is incompatible 11 | document.documentElement.className = 'incompatible ' + document.documentElement.className; 12 | } 13 | }; 14 | 15 | module.exports = incompDetect; 16 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/utilities/incompatible.js: -------------------------------------------------------------------------------- 1 | /* eslint key-spacing: 0, comma-spacing: 0 */ 2 | 3 | 'use strict'; 4 | 5 | var UAParser = require('ua-parser-js'), 6 | uaParser = new UAParser(), 7 | incompatible = {}; 8 | 9 | incompatible.uaResult = uaParser.getResult(); 10 | 11 | /** 12 | * Check browser compatibility 13 | * 14 | * @return {Boolean} - for uncompatible browser return 'true', otherwise 'false' 15 | */ 16 | incompatible.isIncompatibleBrowser = function () { 17 | var listOfSupported = [ 18 | { browser: 'Chrome' , version: 43 }, 19 | { browser: 'Firefox' , version: 38 }, 20 | { browser: 'Safari' , version: 7 }, 21 | { browser: 'Mobile Safari', version: 7 }, 22 | { browser: 'IE' , version: 11 }, 23 | { browser: 'Edge' , version: 12 }, 24 | { browser: 'IEMobile' , version: 11 } 25 | ], 26 | incomp = true, 27 | i; 28 | 29 | for (i = 0; i < listOfSupported.length; i++) { 30 | if (listOfSupported[i].browser === incompatible.uaResult.browser.name && 31 | listOfSupported[i].version <= parseInt(incompatible.uaResult.browser.major)) { 32 | incomp = false; 33 | } 34 | } 35 | 36 | return incomp; 37 | }; 38 | 39 | module.exports = incompatible; 40 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/utilities/loader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createjs = require('createjs'), 4 | loaderData = require('./loaderData'), 5 | _loader = {}; 6 | <% if (soundjs) { %> 7 | // initialize SoundJS - use 'createjs' object to work with 'SoundJS' 8 | require('SoundJS'); 9 | <% } %><% if (easeljs) { %> 10 | // initialize EaselJS - use 'createjs' object to work with 'EaselJS' 11 | require('EaselJS'); 12 | <% } %> 13 | /** 14 | * Create loader 15 | * 16 | * @param {string} id - id of new loader 17 | * @param {function} progressCb - callback function during loading 18 | * @param {function} completeCb - callback function when loading is completed 19 | */ 20 | var createLoader = function (id, progressCb, completeCb) { 21 | if (_loader[id] != null) { 22 | throw new Error('Loader with id: ' + id + ' already exists.'); 23 | } 24 | 25 | _loader[id] = new createjs.LoadQueue(true); 26 | <% if (soundjs) { %> 27 | createjs.Sound.alternateExtensions = ['mp3']; 28 | _loader[id].installPlugin(createjs.Sound); 29 | <% } %> 30 | _loader[id].addEventListener('progress', progressCb); 31 | _loader[id].addEventListener('complete', completeCb); 32 | 33 | _loader[id].loadManifest(loaderData); 34 | }; 35 | 36 | /** 37 | * Create spy loader for unit tests 38 | * 39 | * @param {string} id - id of a loaderData 40 | * @param {string} value - return value of the new loaderData 41 | */ 42 | var createSpyLoader = function (id, value) { 43 | if (_loader[id] != null) { 44 | throw new Error('Loader with id: ' + id + ' already exists.'); 45 | } 46 | 47 | _loader[id] = { 48 | getResult: function () { return value; } 49 | }; 50 | }; 51 | 52 | /** 53 | * Get loader by its id 54 | * 55 | * @param {string} id - id of a loaderData 56 | */ 57 | var getLoader = function (id) { 58 | if (_loader[id] == null) { 59 | throw new Error('Loader with id: ' + id + ' does not exist.'); 60 | } 61 | 62 | return _loader[id]; 63 | }; 64 | 65 | module.exports = { 66 | createLoader: createLoader, 67 | createSpyLoader: createSpyLoader, 68 | getLoader: getLoader 69 | }; 70 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/utilities/loaderData.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var dataCommon = require('../data/loader-common.json'), 4 | dataNoRetina = require('../data/loader-no-retina.json'), 5 | dataRetina = require('../data/loader-retina.json'), 6 | isRetina = window.devicePixelRatio > 1, 7 | data; 8 | 9 | if (isRetina) { 10 | data = dataCommon.concat(dataRetina); 11 | data.push({ id: 'assets-css', src: 'css/assets/assets-retina.css' }); 12 | } else { 13 | data = dataCommon.concat(dataNoRetina); 14 | data.push({ id: 'assets-css', src: 'css/assets/assets-no-retina.css' }); 15 | } 16 | 17 | module.exports = data; 18 | -------------------------------------------------------------------------------- /app/templates/es5/src/scripts/utilities/version.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var versionJson = require('../data/version.json'), 4 | appSettings = require('./appSettings'); 5 | 6 | /** 7 | * Print version info 8 | */ 9 | var version = function () { 10 | var el; 11 | 12 | if (!appSettings.renderVersionInfo) { 13 | return; 14 | } 15 | 16 | // print version to console 17 | if (console && console.log) { 18 | console.log( 19 | '\n%cv' + versionJson.version + '%c %c' + versionJson.time + '%c\n\n', 20 | 'color: #ffffff; background: #00aa00; padding: 1px 5px;', 21 | 'color: #ffffff; background: #d1eeee; padding: 1px 5px;', 22 | 'color: #ffffff; background: #00aa00; padding: 1px 5px;', 23 | 'background: #ffffff;' 24 | ); 25 | } 26 | 27 | // print version to page 28 | el = document.createElement('div'); 29 | el.className = 'version'; 30 | el.innerHTML = ( 31 | '
' + 32 | 'v' + versionJson.version + ' | ' + versionJson.time + '' + 33 | '
' 34 | ); 35 | 36 | document.body.appendChild(el); 37 | }; 38 | 39 | module.exports = version; 40 | -------------------------------------------------------------------------------- /app/templates/es5/test/e2e/spec.js: -------------------------------------------------------------------------------- 1 | /* eslint-env protractor */ 2 | 3 | 'use strict'; 4 | 5 | describe('HOME PAGE', function () { 6 | beforeEach(function () { 7 | browser.get(''); 8 | }); 9 | 10 | it('Should have title', function () { 11 | expect(browser.getTitle()).toEqual(jasmine.any(String)); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /app/templates/es5/test/unit/_enterSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('angular'); 4 | require('angular-mocks'); 5 | 6 | require('./controllersSpec'); 7 | require('./directivesSpec'); 8 | require('./filtersSpec'); 9 | require('./servicesSpec'); 10 | -------------------------------------------------------------------------------- /app/templates/es5/test/unit/controllersSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | 'use strict'; 4 | 5 | var angular = require('angular'), 6 | mCtrls = require('../../src/scripts/app/controllers/_loader'), 7 | loader = require('../../src/scripts/utilities/loader'); 8 | 9 | describe('Controllers', function () { 10 | 11 | loader.createSpyLoader('main', 'spy loader data'); 12 | 13 | describe('MyCtrl', function () { 14 | var $scope; 15 | 16 | beforeEach(angular.mock.module(mCtrls)); 17 | 18 | beforeEach(inject(function ($rootScope, $controller) { 19 | $scope = $rootScope.$new(); 20 | $controller('MyCtrl', { $scope: $scope }); 21 | })); 22 | 23 | it('Placeholder', function () { 24 | expect($scope.test).toBe('test'); 25 | }); 26 | 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /app/templates/es5/test/unit/directivesSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | 'use strict'; 4 | 5 | describe('Directives', function () { 6 | 7 | var $compile, 8 | $rootScope; 9 | 10 | // beforeEach(angular.mock.module('mDirectives')); 11 | 12 | beforeEach(inject(function (_$compile_, _$rootScope_) { 13 | $compile = _$compile_; 14 | $rootScope = _$rootScope_; 15 | })); 16 | 17 | it('Placeholder', function () { 18 | var scope = $rootScope.$new(), 19 | element; 20 | 21 | scope.variable = 'Hello World'; 22 | element = $compile('
')(scope); 23 | scope.$digest(); 24 | 25 | expect(element.html()).toContain('Hello World'); 26 | }); 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /app/templates/es5/test/unit/filtersSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | 'use strict'; 4 | /* 5 | describe('Filters', function () { 6 | describe('', function() { 7 | beforeEach(angular.mock.module('')); 8 | it('', inject(function (nameFilter) { 9 | expect(nameFilter('argv')).toEqual(0); 10 | })); 11 | }); 12 | }); 13 | */ 14 | -------------------------------------------------------------------------------- /app/templates/es5/test/unit/servicesSpec.js: -------------------------------------------------------------------------------- 1 | /* globals inject */ 2 | 3 | 'use strict'; 4 | /* 5 | describe('Services', function () { 6 | var service; 7 | 8 | beforeEach(angular.mock.module('mServices')); 9 | 10 | beforeEach(inject(function (_service_) { 11 | service = _service_; 12 | })); 13 | 14 | it('check if `service` exists', function () { 15 | expect(service).toBeDefined(); 16 | }); 17 | 18 | }); 19 | */ 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-angular-webpack", 3 | "version": "0.5.9", 4 | "description": "Yeoman generator for AngularJS with Webpack - ES2015 (Babel) or ES5", 5 | "license": "MIT", 6 | "main": "app/index.js", 7 | "repository": "KarolAltamirano/generator-angular-webpack", 8 | "author": { 9 | "name": "Karol Altamirano", 10 | "email": "karlos.altamirano@gmail.com", 11 | "url": "https://github.com/KarolAltamirano" 12 | }, 13 | "files": [ 14 | "app" 15 | ], 16 | "keywords": [ 17 | "yeoman-generator" 18 | ], 19 | "dependencies": { 20 | "chalk": "^1.1.1", 21 | "lodash": "^4.3.0", 22 | "yeoman-generator": "^0.22.5", 23 | "yosay": "^1.1.0" 24 | } 25 | } 26 | --------------------------------------------------------------------------------