Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabiandev/gulp-ng2-relative-path
Gulp plugin to support relative paths in Angular2 for template and style files.
https://github.com/fabiandev/gulp-ng2-relative-path
angular gulp javascript
Last synced: about 1 month ago
JSON representation
Gulp plugin to support relative paths in Angular2 for template and style files.
- Host: GitHub
- URL: https://github.com/fabiandev/gulp-ng2-relative-path
- Owner: fabiandev
- License: other
- Created: 2016-04-02T12:38:14.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-16T18:24:20.000Z (about 8 years ago)
- Last Synced: 2024-12-27T06:00:59.622Z (about 2 months ago)
- Topics: angular, gulp, javascript
- Language: JavaScript
- Size: 9.77 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-ng2-relative-path
Use relative paths within Angular2 components for `templateUrl` and `styleUrls`.
This package is based on the work of [gulp-inline-ng2-template](https://github.com/ludohenin/gulp-inline-ng2-template).
# Installation
```bash
npm install --save-dev gulp-ng2-relative-path
```# Configurations
```js
var defaults = {
base: './', // Source base folder
appBase: '/', // Angular app base folder
templateExtension: '.html', // Template file extension
processTemplatePaths: true, // Enable or disable template paths processing
processStylePaths: true, // Enable or disable style paths processing
modifyPath: false, // Function to additionally modify all file paths
modifyTemplatePath: false, // Function to modify only template paths
modifyStylePath: false // Function to modify only style paths
};
```# Example Usage
```js
var ng2RelativePath = require('gulp-ng2-relative-path');var result = gulp.src('./src/ts/**/*.ts')
.pipe(ng2RelativePath({
base: './src/ts',
appBase: '/app',
modifyStylePath: function (path) {
return path.replace('.less', '.css');
}
}))
.pipe(tsc());return result.js
.pipe(gulp.dest('./dist/app'));
```