Skip to content

Commit

Permalink
load fonts for dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Enlcxx committed Dec 9, 2018
1 parent 8996203 commit d84003d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"tools:typedoc": "yarn typedoc --mode modules --json dist/docs.json --tsconfig tsconfig.td.json --excludePrivate --excludeProtected --excludeExternals",
"tools:docs": "yarn tools:typedoc && node dist/tools/docs",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"bundlesizelimit": "rm -rf dist/bundle.js && cat dist/@alyle/ui/**/*.umd.min.js >> dist/bundle.js && yarn bundlesize -f dist/bundle.js -c false -s '200 KB'"
"bundlesizelimit": "rm -rf dist/bundle.js && cat dist/@alyle/ui/**/*.umd.min.js >> dist/bundle.js && yarn bundlesize -f dist/bundle.js -c false -s '200 KB'",
"serve:lib": "hs src/app -p 1212 -g --cors 'Access-Control-Allow-Origin'"
},
"private": true,
"dependencies": {
Expand Down
24 changes: 14 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ if (environment.production) {

const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);

// document.addEventListener('DOMContentLoaded', () => {
if (environment.hmr) {
if (module[ 'hot' ]) {
hmrBootstrap(module, bootstrap);
} else {
console.error('HMR is not enabled for webpack-dev-server!');
console.log('Are you using the --hmr flag for ng serve?');
}
if (environment.hmr) {
if (module[ 'hot' ]) {
hmrBootstrap(module, bootstrap);
} else {
bootstrap();
console.error('HMR is not enabled for webpack-dev-server!');
console.log('Are you using the --hmr flag for ng serve?');
}
// });
} else {
if (!environment.production) {
const style = <HTMLLinkElement>window.document.createElement('link');
style.setAttribute('href', 'http://localhost:10009/fonts.css');
style.setAttribute('rel', 'stylesheet');
window.document.head.appendChild(style);
}
bootstrap();
}

0 comments on commit d84003d

Please sign in to comment.