Skip to content
TANIGUCHI Masaya edited this page Nov 6, 2017 · 2 revisions

Configuration

Put s2s.config.js into your project's root. s2s requires you to set watch and plugins, templates.

module.exports = {
  watch: './**/*.js', // string
  plugins: [],
  templates: [],
}

watch

You can use Glob in this section to set targets.

plugins

Set the array of the objects. You have to set test and plugin.

  • test requires you to set targets with regular expression.
  • plugin allows you, same as .babelrc, to set the name of plugin and the array of options you wants.
type EventType = 'add' | 'change' | 'unlink'
type Only = EventType[]
type PluginOpts = PluginName | [PluginName, Object]

type Plugin = {|
  test: RegExp,
  plugin: PluginOpts,
  only?: Only,
  input?: FileName,
  output?: FileName,
|}

templates

Copy a template from files. the template requires you to set test and input.

  • test requires you, same as plugins, to set paths to files with regular expression.
  • input requires you to set the file in the template directory.
type Template = {|
  test: RegExp,
  input: Path,
  output?: Path,
|}
Clone this wiki locally