Skip to content

Commit

Permalink
fix #16 with includes & Promise polyfill added
Browse files Browse the repository at this point in the history
  • Loading branch information
leftstick committed Mar 20, 2017
1 parent de3bb64 commit 9dc9ad3
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 54 deletions.
10 changes: 10 additions & 0 deletions generators/app/templates/index.html_vm
Expand Up @@ -4,10 +4,20 @@
<% if (answers.pushState) { %><base href="/"><% } %>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

<style id="style-spinner">
#spinner-loader {position: fixed;top: 40%;left: 50%;margin-left: -22.5px;font-size: 10px;text-indent: -9999em;width: 45px;height: 45px;border-radius: 50%;background: #1e72b3;background: -moz-linear-gradient(left, #1e72b3 10%, rgba(255, 255, 255, 0) 42%);background: -webkit-linear-gradient(left, #1e72b3 10%, rgba(255, 255, 255, 0) 42%);background: -o-linear-gradient(left, #1e72b3 10%, rgba(255, 255, 255, 0) 42%);background: -ms-linear-gradient(left, #1e72b3 10%, rgba(255, 255, 255, 0) 42%);background: linear-gradient(to right, #1e72b3 10%, rgba(255, 255, 255, 0) 42%);-webkit-animation: load3 1.4s infinite linear;animation: load3 1.4s infinite linear;-webkit-transform: translateZ(0);-ms-transform: translateZ(0);transform: translateZ(0);}
#spinner-loader:before {width: 50%;height: 50%;background: #1e72b3;border-radius: 100% 0 0 0;position: absolute;top: 0;left: 0;content: '';}
#spinner-loader:after {background: #fff;width: 75%;height: 75%;border-radius: 50%;content: '';margin: auto;position: absolute;top: 0;left: 0;bottom: 0;right: 0;}
@-webkit-keyframes load3 {0% {-webkit-transform: rotate(0deg);transform: rotate(0deg);}100% {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}
@keyframes load3 {0% {-webkit-transform: rotate(0deg);transform: rotate(0deg);}100% {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}
</style>
</head>
<body>

<application></application>

<div id="spinner-loader">Loading...</div>

</body>
</html>
8 changes: 8 additions & 0 deletions generators/app/templates/js/fw/ext/polyfill.js
@@ -0,0 +1,8 @@

if (!Array.prototype.includes) {
require('core-js/fn/array/includes');
}

if (typeof Promise === 'undefined') {
require('core-js/fn/promise');
}
18 changes: 0 additions & 18 deletions generators/app/templates/js/index.js

This file was deleted.

15 changes: 6 additions & 9 deletions generators/app/templates/js/main.js
Expand Up @@ -5,6 +5,7 @@
* @date <%= answers.date %>
*
*/
import './fw/ext/polyfill';
import angular from 'angular';
import {pluck} from './fw/helper/object';
import {declareFeatures, declareValues, declareDirectives, declareComponents, declareRunners, declareFilters} from './fw/helper/ngDeclare';
Expand All @@ -13,9 +14,8 @@ import Configurators from './fw/config/main';
import Values from './fw/value/main';
import Things from './features/main';
import Application from './application';
import {Splash} from 'splash-screen';

export default class {
class App {

constructor() {
this.appName = '<%= answers.name %>';
Expand Down Expand Up @@ -61,13 +61,8 @@ export default class {
}

destroySplash() {
Splash.destroy();
require('splash-screen/dist/splash.min.css').unuse();
setTimeout(() => {
if (Splash.isRunning()) {
this.destroySplash();
}
}, 100);
document.head.removeChild(document.querySelector('#style-spinner'));
document.body.removeChild(document.querySelector('#spinner-loader'));
}

launch() {
Expand All @@ -84,3 +79,5 @@ export default class {
this.launch();
}
}

new App().run();
27 changes: 13 additions & 14 deletions generators/app/templates/package.json_vm
Expand Up @@ -4,7 +4,7 @@
"description": "<%= answers.description %>",
"scripts": {
"release": "rm -rf build; webpack --config webpack.config.prod.js",
"start": "webpack-dev-server --hot --inline --host 0.0.0.0"
"start": "webpack-dev-server --hot --inline"
},
"files": [
"etc",
Expand All @@ -18,23 +18,22 @@
"author": "<%= answers.username %> <% if(answers.email){ %><<%= answers.email %>><% } %>",
"license": "MIT",
"dependencies":{
"angular": "^1.6.2",
"angular-route": "^1.6.2",
"splash-screen": "^3.0.1"
"angular": "^1.6.3",
"angular-route": "^1.6.3"
},
"devDependencies": {
"autoprefixer": "^6.7.4",
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"autoprefixer": "^6.7.7",
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"babel-plugin-angularjs-annotate": "^0.7.0",
"babel-preset-es2015": "^6.22.0",
"css-loader": "^0.26.1",
"file-loader": "^0.10.0",
"babel-preset-es2015": "^6.24.0",
"css-loader": "^0.27.3",
"file-loader": "^0.10.1",
"html-webpack-plugin": "^2.28.0",
"postcss-loader": "^1.3.1",
"html-loader": "^0.4.4",
"style-loader": "^0.13.1",
"postcss-loader": "^1.3.3",
"html-loader": "^0.4.5",
"style-loader": "^0.14.1",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
"webpack-dev-server": "^2.4.2"
}
}
10 changes: 4 additions & 6 deletions generators/app/templates/webpack.config.js
Expand Up @@ -4,7 +4,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: {
index: './js/index.js'
index: './js/main.js'
},
output: {
path: path.resolve(__dirname, 'build'),
Expand All @@ -15,14 +15,12 @@ module.exports = {
devtool: 'source-map',
devServer: {
contentBase: path.resolve(__dirname, 'build'),
historyApiFallback: true
historyApiFallback: true,
port: 8080,
host: '0.0.0.0'
},
module: {
rules: [
{
test: /splash\.min\.css$/,
use: ['style-loader/useable']
},
{
test: /(?!min)\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader']
Expand Down
6 changes: 1 addition & 5 deletions generators/app/templates/webpack.config.prod.js
Expand Up @@ -4,7 +4,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: {
index: './js/index.js'
index: './js/main.js'
},
output: {
path: path.resolve(__dirname, 'build'),
Expand All @@ -14,10 +14,6 @@ module.exports = {
},
module: {
rules: [
{
test: /splash\.min\.css$/,
use: ['style-loader/useable']
},
{
test: /(?!min)\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader']
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "generator-es6-angular",
"version": "5.0.3",
"version": "5.0.4",
"description": "generator-es6-angular",
"repository": {
"type": "git",
Expand All @@ -27,6 +27,6 @@
"dependencies": {
"date-util": "^1.2.1",
"lodash": "^4.17.4",
"yeoman-generator": "^1.1.0"
"yeoman-generator": "^1.1.1"
}
}

0 comments on commit 9dc9ad3

Please sign in to comment.