Prequisite
You need to copy all the templates & sass files manually to the aot outdir (set in the tsconfig.json) before bundling.
copyfiles src/**/*scss distcopyfiles src/**/*html dist
rollup-plugin-angular-aot
Angular2 template and styles inliner for rollup
Installation
npm install --save-dev rollup-plugin-angular-aot
Example
// rollup.config.js;;;; entry: 'src/main.ts' format: 'iife' dest: 'dist/bundle.js' plugins: // rxjs fix (npm install rxjs-es)
Template & Style preprocessing
You may need to do some preprocessing on your templates & styles such as minification and/or transpilation.
To do this you can pass a preprocessors object as an option, containing a style and/or template preprocessor.
Signature
preprocessors:
source
- The contents of the style or template's file.
path
- The path to the loaded file. Can be useful for checking file extensions for example.
returns the manipulated source as a string.
Example
The following example shows how you can use sass, clean-css (for css minification), and htmlmin.
// rollup.config.js;;;;;; const cssmin = ;const htmlminOpts = caseSensitive: true collapseWhitespace: true removeComments: true; entry: 'src/main.ts' format: 'iife' dest: 'dist/bundle.js' plugins: