ko-prefix-preprocess

Binding provider pre-processor for changing binding attribute syntax

Usage no npm install needed!

<script type="module">
  import koPrefixPreprocess from 'https://cdn.skypack.dev/ko-prefix-preprocess';
</script>

README

Prefix Pre-Processor

Knockout Prefix Pre-Processor provides a binding provider pre-processor for adding custom binding attribute syntax.

Usage

The default pre-processor will convert ko-x="y" to data-bind="x: y" runtime. The prefix can be anything HTML5 standards allow in attributes, example 'ko-' or 'ko:'. The default pre-processor will return value as is to binding handler.

const preprocess = require('ko-prefix-preprocess')
// also globally exported as 'koPrefixPreprocess'
ko.bindingProvider.instance.preprocessNode = preprocess('ko-', 'data-bind')

Multiple Pre-Processors

preprocess.configInstance(
    ko.bindingProvider.instance,
    ...
    preprocess.default('ko-', 'data-bind'),
    ...
)