1
1
# gulp-ts-alias ![ npm] ( https://img.shields.io/npm/v/gulp-ts-alias )
2
2
3
- [ ![ Build Status ] ( https://travis-ci.org/dhkatz/gulp-ts-alias.svg?branch=master )] ( https://travis-ci.org/dhkatz/gulp-ts-alias ) [ ![ Coverage Status] ( https://coveralls.io/repos/github/dhkatz/gulp-ts-alias/badge.svg?branch=master )] ( https://coveralls.io/github/dhkatz/gulp-ts-alias?branch=master ) ![ npm] ( https://img.shields.io/npm/dm/gulp-ts-alias )
3
+ [ ![ Coverage Status] ( https://coveralls.io/repos/github/dhkatz/gulp-ts-alias/badge.svg?branch=master )] ( https://coveralls.io/github/dhkatz/gulp-ts-alias?branch=master ) ![ npm] ( https://img.shields.io/npm/dm/gulp-ts-alias )
4
4
5
5
Resolve TypeScript import aliases and paths defined in ` tsconfig ` .
6
6
@@ -10,15 +10,22 @@ Resolve TypeScript import aliases and paths defined in `tsconfig`.
10
10
11
11
## Information
12
12
13
+ ### Features
14
+
15
+ * Supports all import types: ` import ` , ` require ` , ` await import() `
16
+ * Supports wild card aliases
17
+
18
+ ### Motivation
19
+
13
20
There have been previous attempts at releasing Gulp plugins that accomplish something similar, but all have become unmaintained.
14
21
15
22
For legacy’s sake, here is a list of previous packages/scripts that have been considered:
16
23
17
24
[ gulp-ts-paths] ( https://www.npmjs.com/package/gulp-ts-paths )
25
+
18
26
[ path-alias-resolver] ( https://gist.github.com/azarus/f369ee2ab0283ba0793b0ccf0e9ec590 )
19
27
20
- ** Note:** Currently, multiple imports per line are not supported!
21
- Imports within multiline comments may also be replaced.
28
+ ** Note:** Imports within multiline comments may also be replaced.
22
29
23
30
## Usage
24
31
@@ -27,11 +34,13 @@ const typescript = require('gulp-typescript');
27
34
const sourcemaps = require (' gulp-sourcemaps' );
28
35
const alias = require (' gulp-ts-alias' );
29
36
30
- const project = typescript .createProject (' tsconfig.json' );
37
+ const { config } = typescript .createProject (' tsconfig.json' );
31
38
32
39
function build () {
33
40
const compiled = src (' ./src/**/*.ts' )
34
- .pipe (alias ({ configuration: project .config }))
41
+ .pipe (alias (config))
42
+ // or .pipe(alias('tsconfig.json'))
43
+ // or even .pipe(alias())
35
44
.pipe (sourcemaps .init ())
36
45
.pipe (project ());
37
46
0 commit comments