# babel-plugin-static

> babel plugin to replace static file path.

Latest version **0.2.0** (published 2017-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-static
pnpm add babel-plugin-static
yarn add babel-plugin-static
bun add babel-plugin-static
```

## 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.2.0 |
| Published | 2017-09-11 |
| First published | 2016-10-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | csbun |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-static
- npm.io page: https://npm.io/package/babel-plugin-static

## Recent versions

- 0.2.0 (latest) — 2017-09-11
- 0.1.2 — 2016-12-13
- 0.1.1 — 2016-11-09
- 0.1.0 — 2016-10-24

## README

# babel-plugin-static

babel plugin to replace static file path.

[![Build Status](https://travis-ci.org/csbun/babel-plugin-static.svg?branch=master)](https://travis-ci.org/csbun/babel-plugin-static)
[![Coverage Status](https://coveralls.io/repos/github/csbun/babel-plugin-static/badge.svg?branch=master)](https://coveralls.io/github/csbun/babel-plugin-static?branch=master)

## Example

```javascript
/* .babelrc */
{
  "plugins": [
    [ "static", {
      "assetsMapFile": "./config/webpack-assets.json",
      "assetsKey": "assets"
    }]
  ]
}

```

```javascript
/* config/webpack-assets.json */
{
  "assets": {
    "./images/img.png": "http://cdn.example.com/path/to/img"
  }
}
```

```javascript
// src/main.js
const img = require('../images/img.png');
```

will build to:

```javascript
// dist/main.js (builded)
const img = require('../config/webpack-assets.json').assert['./images/img.png'];
```

## Install

```sh
npm i babel-plugin-static -D
```

## Usage

You can dump by using [webpack-isomorphic-tools](https://github.com/halt-hammerzeit/webpack-isomorphic-tools).

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