Gulp plugin to inline Angular 2+ component HTML templates and CSS styles into JavaScript/TypeScript files using ES6 template literals (or ES5 concatenation). Version 6.0.0 drops Node 4 and adds sourcemap support. It is primarily used during build to avoid extra HTTP requests and simplify testing, and is especially helpful for component library authors who want to avoid setting moduleId. Unlike webpack/Angular CLI, this plugin works in Gulp-based workflows and with Browserify.
npm install gulp-inline-ng2-templateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic Gulp task that inlines Angular component templates and styles into TypeScript files, outputting to dist.
Update Node to version 6 or higher.
Remove any custom backslash escaping logic from processors.
Update processor functions to accept (path, ext, file, callback) signature.
Modify templateProcessor and styleProcessor to accept a callback as third argument.
Update configuration to use templateProcessor/styleProcessor instead of html/css props.
Ensure your build pipeline includes a transpiler step after inlining if targeting ES5.
Set base option to the root of your application (e.g., '/src').
Ensure base path and file extensions are configured correctly; consider enabling `supportNonExistentFiles: true`.
Make sure gulp.src includes the files to inline; add `{}` if using glob patterns.Ensure the callback is called (with error or null, and result) exactly once in custom templateProcessor/styleProcessor.
Set target to 'es5' or add a transpiler (e.g., gulp-typescript or gulp-babel) after the inline plugin.
Install @types/gulp-inline-ng2-template if available, or create a custom declaration: `declare module 'gulp-inline-ng2-template';`