0.2.0 • Published 7 years ago

babel-plugin-static v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

babel-plugin-static

babel plugin to replace static file path.

Build Status Coverage Status

Example

/* .babelrc */
{
  "plugins": [
    [ "static", {
      "assetsMapFile": "./config/webpack-assets.json",
      "assetsKey": "assets"
    }]
  ]
}
/* config/webpack-assets.json */
{
  "assets": {
    "./images/img.png": "http://cdn.example.com/path/to/img"
  }
}
// src/main.js
const img = require('../images/img.png');

will build to:

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

Install

npm i babel-plugin-static -D

Usage

You can dump by using webpack-isomorphic-tools.

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

8 years ago

0.1.0

8 years ago