All Projects → gulp-plugin → alias

gulp-plugin / alias

Licence: MIT license
Resolve TypeScript import aliases and paths.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to alias

balm
🃏 An universal Front-End workflow for webapps
Stars: ✭ 26 (+36.84%)
Mutual labels:  gulp
html5-game-development-gulp-workflow
🎮 A gulp workflow that is optimised for HTML5 Game Developement.
Stars: ✭ 13 (-31.58%)
Mutual labels:  gulp
project-manager-laravel
Project manager system - PHP and AngularJS
Stars: ✭ 17 (-10.53%)
Mutual labels:  gulp
luya-kickstarter-bootstrap4
LUYA boilerplate to kickstart projects with Bootstrap 4.
Stars: ✭ 13 (-31.58%)
Mutual labels:  gulp
gulp-reporter
Error report for: CSSLint/EditorConfig/ESLint/HTMLHint/JSCS/JSHint/PostCSS/Standard/TSLint/XO
Stars: ✭ 17 (-10.53%)
Mutual labels:  gulp
wordpress-uikit-timber-theme
UIKit 3 Wordpress Starter Theme
Stars: ✭ 18 (-5.26%)
Mutual labels:  gulp
yunle-template-gatsby
yunle-cli 前端开发模板- gatsby 专为静态SEO页面开发
Stars: ✭ 13 (-31.58%)
Mutual labels:  gulp
twoobl
Blank theme for Elementor
Stars: ✭ 19 (+0%)
Mutual labels:  gulp
sage-starter
The best starter theme with a modern front-end development workflow. Based on Sage, HTML5 Boilerplate, gulp, Bower, and Bootstrap.
Stars: ✭ 42 (+121.05%)
Mutual labels:  gulp
mark.js
mark.js用于标记选中的文字,自定义插入标签
Stars: ✭ 27 (+42.11%)
Mutual labels:  gulp
marmelad
Заготовка фронтенд проекта для продвинутых и начинающих 🤘. Хорошо подходит для поддержания единой структуры проектов в команде и легкого переиспользования готовых блоков между проектами.
Stars: ✭ 15 (-21.05%)
Mutual labels:  gulp
website-template
静的Webサイト制作を少しモダンにするためのテンプレート
Stars: ✭ 62 (+226.32%)
Mutual labels:  gulp
angularJS
这个仓库提供git使用教程 gulp使用教程 angularJS入门->进阶 的教程
Stars: ✭ 61 (+221.05%)
Mutual labels:  gulp
gw-starter-kit
PEPELAC - Современный инструментарий для вёрстки и создания статичных сайтов с использованием Webpack
Stars: ✭ 30 (+57.89%)
Mutual labels:  gulp
lead
Sink your streams.
Stars: ✭ 14 (-26.32%)
Mutual labels:  gulp
gulp
Gulp Türkçe Çeviri
Stars: ✭ 37 (+94.74%)
Mutual labels:  gulp
is-my-train-delayed
An Angular web app built on Heroku with Node & Express. Shows information about delayed trains, and displays that in an easily consumable manner.
Stars: ✭ 15 (-21.05%)
Mutual labels:  gulp
lnv-mobile-base
移动端开发脚手架-基于gulp的使用zepto、handlebars、sass并且带移动端适配方案(flexible.js)的前端工作流,旨在帮助移动端项目的开发
Stars: ✭ 41 (+115.79%)
Mutual labels:  gulp
igni-core
UNSUPPORTED: An easy to use & featherlight CMS that shortcuts the bootstrapping of backend PHP + MySQL based projects. Developed in Laravel, it uses the latest PHP coding standards and library versions.
Stars: ✭ 13 (-31.58%)
Mutual labels:  gulp
fractal-starter-kit
Starter kit for Fractal with SCSS, Webpack, XO, sass-lint and Gulp
Stars: ✭ 22 (+15.79%)
Mutual labels:  gulp

@gulp-plugin/alias npm (custom registry) GitHub Package Registry version

Build Coverage Status dependencies Status

Resolve TypeScript import aliases and paths defined in tsconfig.

Install

npm install --save-dev @gulp-plugin/alias

Information

Features

  • Supports all import types: import, require, await import()
  • Supports wild card aliases

Motivation

There have been previous attempts at releasing Gulp plugins that accomplish something similar, but all have become unmaintained.

For legacy’s sake, here is a list of previous packages/scripts that have been considered:

gulp-ts-paths

path-alias-resolver

Note: Imports within multiline comments may also be replaced.

Usage

const typescript = require('gulp-typescript');
const sourcemaps = require('gulp-sourcemaps');
const alias = require('@gulp-plugin/alias');

const { config } = typescript.createProject('tsconfig.json');

function build() {
  const compiled = src('./src/**/*.ts')
    .pipe(alias(config))
    // or .pipe(alias('tsconfig.json'))
    // or even .pipe(alias())
    .pipe(sourcemaps.init())
    .pipe(project());

  return compiled.js
    .pipe(sourcemaps.write({ sourceRoot: file => path.relative(path.join(file.cwd, file.path), file.base) }))
    .pipe(dest('build/'))
}

Example

The following configuration is common in tsconfig configuration files

{
  "rootDir": "./src",
  "baseUrl": ".",
  "paths": {
    "@/*": ["src/*"]
  }
}

In practice, these path aliases are often used in this fashion

Input:

import express from 'express';

import A from './file'; // Normal relative import

// Aliased import, resolves to some relative path to rootDir
import B from '@/components';

Output:

import express from 'express';

import A from './file';

// gulp-ts-alias finds the correct relative path
// and replaces it before compilation
import B from '../../components';
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].