Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
angular-inline-template-style
Advanced tools
Resolve templateUrl
and styleUrls
in Angular2 components.
$ npm install --save angular2-inline-template-style
Just clone the repository and run:
npm install
npm link
Linking requires administration rights, e.g. sudo on Mac. After the package has been linked, you should be able to call ng2-inline from command line.
/* component.css */
h1 {
color: #ff0000;
}
/* component.html */
<h1>Hello World</h1>
const ng2Inline = require('angular2-inline-template-style');
let content = `
import {Component} from 'angular2/core';
@Component({
selector: 'foo',
templateUrl: 'component.html'
styleUrls: ['component.css']
})
export class ComponentX {
constructor() {}
}
`;
ng2Inline(content, {});
// Output
import {Component} from 'angular2/core';
@Component({
selector: 'foo',
template: '<h1>Hello World</h1>',
styles: ['h1 { color: #ff0000; }']
})
export class ComponentX {
constructor() {}
}
Type: string
The file content to be processed.
Type: string
Default: './'
Base folder for templates and stylesheet files.
Type: boolean
Default: false
Use html-min and clean-css to compress the templates before they are inlined.
Type: string[]
Default: []
Alternate folder paths for node-sass to search for @imports
Use node-sass
ng2-inline [--outDir|-o] [--base|-b] [--relative|-r] [--flatten|-f] [--up|-u <count>] [--compress|-c] [--watch|-w] [--sourceOverwrite|-s] <path glob>
count
leading folders from the source locations when writing to --outDirng2-inline -o dist -f -b src/components "src/components/**/*.js"
It will take all .js files (recursively) from src/components
and insert template/style URLs, found relative to src/components
, and output them to ./dist/
with leading paths removed.
Important! note that glob pattern "src/components/**/*.js"
is surrounded with quotation marks. Without it, only a single file will get matched and passed down to ng2-inline
.
Help wanted for implementing:
MIT
FAQs
Resolve styleUrls in Angular2 components.
The npm package angular-inline-template-style receives a total of 5 weekly downloads. As such, angular-inline-template-style popularity was classified as not popular.
We found that angular-inline-template-style demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.