Skip to content

Instantly share code, notes, and snippets.

Avatar

Cyrille Tuzi cyrilletuzi

View GitHub Profile
View amazing.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@NgModule({
imports: [CommonModule]
})
export class AmazingModule {}
View amazing.module.ts
import { NgModule } from '@angular/core';
import { PrivateComponent } from './private.component';
import { PublicComponent } from './public.component';
@NgModule({
declarations: [
PrivateComponent,
PublicComponent
],
View tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"noImplicitAny": true,
"module": "es2015",
"moduleResolution": "node",
View package.json
{
"scripts": {
"transpile": "ngc",
"package": "rollup -c",
"minify": "uglifyjs dist/bundles/amazing.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/amazing.umd.min.js",
"build": "npm run transpile && npm run package && npm run minify"
}
}
View rollup.config.js
export default {
entry: 'dist/index.js',
dest: 'dist/bundles/amazing.umd.js',
sourceMap: false,
format: 'umd',
moduleName: 'ng.amazing',
globals: {
'@angular/core': 'ng.core',
'rxjs/Observable': 'Rx',
'rxjs/ReplaySubject': 'Rx',
View index.ts
export { AmazingModule } from './amazing.module';
export { AmazingComponent } from './amazing.component';
export { AmazingService } from './amazing.service';
View systemjs.config.js
System.config({
map: {
'@angular/core': 'node_modules/@angular/core/bundles/core.umd.js',
'angular-async-local-storage': 'node_modules/angular-async-local-storage/bundles/async-local-storage.umd.js'
}
});
View good.html
<!-- Good structure -->
<div id="wrapper-global">
<div id="header">
<div id="header-logo">Logo (on the left)</div>
<div id="header-nav">Menu (on the right)</div>
</div>
<div id="wrapper-main">
<div id="content">
<div class="story">Article 1</div>
<div class="story">Article 2</div>