# babel-plugin-ng-template-url-absolutify

> Transform AngularJS templateUrl relative paths to absolute URLs.

Latest version **0.1.4** (published 2018-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-ng-template-url-absolutify
pnpm add babel-plugin-ng-template-url-absolutify
yarn add babel-plugin-ng-template-url-absolutify
bun add babel-plugin-ng-template-url-absolutify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2018-09-14 |
| First published | 2018-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ViES |
| Maintainers | vies |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-ng-template-url-absolutify
- Repository: https://github.com/ViieeS/babel-plugin-ng-template-url-absolutify
- Homepage: https://github.com/ViieeS/babel-plugin-ng-template-url-absolutify#readme
- Issues: https://github.com/ViieeS/babel-plugin-ng-template-url-absolutify/issues
- npm.io page: https://npm.io/package/babel-plugin-ng-template-url-absolutify

## Recent versions

- 0.1.4 (latest) — 2018-09-14
- 0.1.3 — 2018-09-14
- 0.1.2 — 2018-07-11
- 0.1.1 — 2018-03-14
- 0.1.0 — 2018-03-14

## README

# babel-plugin-ng-template-url-absolutify

Transform AngularJS templateUrl relative paths to absolute URLs.

```
$ npm install babel-plugin-ng-template-url-absolutify --save-dev
```

## Usage

Use in either package.json or with gulp:

### a) Package.json

Add the transform in package.json:

#### Babel
```json
{
  "babel": {
      "presets": ["env"],
      "extensions": [".es6"],
      "plugins": [
        ["babel-plugin-ng-template-url-absolutify", {"baseDir": "./app", "baseUrl": "http://mysite.com/"}]
      ]
  }
  
}
```

#### Browserify with Babelify
```json
{
  "browserify": {
    "transform": [
      ["babelify", {
          "presets": ["env"],
          "extensions": [".es6"],
          "plugins": [
            ["babel-plugin-ng-template-url-absolutify", {"baseDir": "./app", "baseUrl": "http://mysite.com/"}]
          ]
        }
      ]
    ]
  }
}
```

### b) With Gulp + Browserify with Babelify

Add it to the babelify object and specify a `baseDir` and `baseUrl`.

```js
var gulp  = require('gulp'),
    browserify = require('browserify');

gulp.task('scripts', function() {
  return browserify('./src/app.js')
    .transform("babelify", {
                presets: ["env"],
                extensions: [".es6"],
                plugins: [[
                  "babel-plugin-ng-template-url-absolutify",
                  {baseDir: "./app", baseUrl: "http://mysite.com/"}
                ]]
            })
    .bundle()
    .pipe(source('bundle.js'))
    .pipe(gulp.dest('./dist'));
});
```

## Example

#### Before:
```js
'use strict';

angular.module('app').component('cmp', {
    controller: function () {/* ... */},
    templateUrl: './template.html'
});
```

#### After:
```js
'use strict';

angular.module('app').component('cmp', {
    controller: function () {/* ... */},
    templateUrl: 'http://mysite.com/app/template.html'
});
```

## License

[MIT License](http://en.wikipedia.org/wiki/MIT_License)

---
_Source: https://npm.io/package/babel-plugin-ng-template-url-absolutify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
