Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This is equivalent to following default configuration:
{
"name": "[hash].[ext]",
"extensions": ["png", "jpg", "jpeg", "gif", "svg"],
"rootPath": "/root/path/to/app",
"publicPath": "/public",
"outputPath": "/public",
"context": "",
Expand Down Expand Up @@ -69,6 +70,10 @@ For real-life example go to [examples](https://github.com/sheerun/babel-plugin-f

## Options

### rootPath

This is a relative or absolute path to use with `outputPath` to ensure files are copied to the correct location.

### outputPath

Tells where to put static files. By default it's `"/public"`.
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const applyTransform = (p, t, state, value, calleeName) => {

if (options.extensions && options.extensions.indexOf(ext.slice(1)) >= 0) {
try {
const rootPath = state.file.opts.sourceRoot || process.cwd()
const rootPath = options.rootPath || state.file.opts.sourceRoot || process.cwd()
const scriptDirectory = dirname(resolve(state.file.opts.filename))
const filePath = resolve(scriptDirectory, value)

Expand Down