Compile Ractive.js components using rollup.js and the Ractive bin
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This rollup plugin allows you to write Ractive.js components and pre-compile them with the rest of your build.


npm install --save-dev rollup-plugin-ractive-bin


Import the plugin from your rollup config or add it on the command line.

Then you can write components like this:

<!-- you can also use a link tag with an external stylesheet -->
  /* styles are concatenated, stringified, and injected wherever $CSS is found in the template */
  .my-ractive-component {
    margin: 1em;
    background-color: #eee;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0,12), 0 1px 2px rgba(0, 0, 0, 0.24);
    padding: 1em;

<script type="text/ractive" id="myPartial">
    Partials can be added as scripts with a type of text/ractive or text/html.
    They can also include a src attribute to be loaded from an external file.

<!-- any html is gathered up to be parsed and injected wherever $TEMPLATE is found in the script -->
<div class="my-ractive-component">
  <button on-click="['go']">Go</button>

  // any non-partial scripts are concatenated
  // ES module syntax is _strongly_ recommended
  import Ractive from 'ractive';

  export default Ractive.extend({
    template: $TEMPLATE,
    css: $CSS,
    on: {
      go() { alert('Hello, from my webpacked Ractive.js component!'); }

  // external scripts can also be loaded and concatenated with any inline scripts
  // by supplying a relative src attribute