Skip to content

Instantly share code, notes, and snippets.

@hartraft
Created October 4, 2017 15:17
Show Gist options
  • Save hartraft/554654e9481c13941deefdcc2dab7386 to your computer and use it in GitHub Desktop.
Save hartraft/554654e9481c13941deefdcc2dab7386 to your computer and use it in GitHub Desktop.
rollup.config.js with typescript and node module , angular templateUrl / styleUrl resolution & SASS processing. Line 23-28 resolves the templateUrl / styleUrl in angular components
// rollup.config.js with typescript and node module , angular templateUrl / styleUrl resolution & SASS processing
import angular from 'rollup-plugin-angular';
import typescript from 'rollup-plugin-typescript';
import nodeResolve from 'rollup-plugin-node-resolve';
import sass from 'node-sass';
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',
'rxjs/add/operator/map': 'Rx.Observable.prototype',
'rxjs/add/operator/mergeMap': 'Rx.Observable.prototype',
'rxjs/add/observable/fromEvent': 'Rx.Observable',
'rxjs/add/observable/of': 'Rx.Observable'
},
plugins: [
angular(
{
preprocessors:{
template:template => template,
style: scss => {
let css;
if(scss){
css = sass.renderSync({ data: scss }).css.toString();
}else{
css = '';
}
return css;
},
}
}
),
typescript({
typescript:require('typescript')
}),
resolve({module: true, main: true}),
commonjs({
include: 'node_modules/**',
})
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment