Licence
MIT
Version
1.1.2-alpha.0
Deps
0
Size
24 kB
Vulns
0
Weekly
0
@what-src/babel-plugin
what-src babel-plugin.
Check out the packages folder for more information.
Usage
Via .babelrc or babel-loader.
{
"plugins": [["module:@what-src/plugin", options]]
}
options
options are defined by the type
type WhatSrcPluginOptions = {
productionMode?: boolean;
enableXkcdMode?: boolean;
useRemote?: boolean;
serverUrl?: string;
dataTag?: string;
globalCacheKey?: string;
stopPropagation?: boolean;
preventDefault?: boolean;
};
- productionMode: [boolean]
- Set 'true' to enable running what-src in production mode (default:
false)
- enableXkcdMode: [boolean]
- Set
trueto enable the click tracking feature and have your clicks (and everyone else's ifuseRemoteis also used) count towards the total time saved number displayed on the website (default:false)
- useRemote: [boolean]
- Set 'true' to enable remote mode which creates links to the source code on github (default:
false)
Note: This requires your code to be in a valid
.gitdirectory. The generated url will be based on the current branch at the time the code is compiled by babel .
- serverUrl: [string]
- The full URL of the running @what-src/express server (default:
http://localhost:8018/__what_src)
- dataTag: [string]
- A valid data attribute for tagging elements (default:
data-what-src)
- globalCacheKey: [string]
- The global cache key the click callback is keyed to (default:
__what-src-global-callback-key)
- stopPropagation: [boolean]
- Sets the stopPropagation property of the click event (default:
true)
- preventDefault: [boolean]
- Sets the preventDefault property of the click event (default:
true)