JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q30703F
  • License MIT

webpack loader for rml

Package Exports

  • rml-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rml-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rml-loader


webpack loader for rml(react markup language)

NPM version npm download

usage

module: {
  loaders: [
    {
      test: /\.rml$/,
      loaders: ['babel','rml-loader?allowImportComponent']
    },
  ],
},

see index.js webpack.config.js index.html inside tests dir.

preview

index.js

import render from './index.rml';

const Page = React.createClass({
  getInitialState() {
    return {
      items: [
        {
          title: 'item1',
        },
        {
          title: 'item2'
        },
      ],
    };
  },
  render() {
    return render.call(this, this.state);
  },
});

index.rml

<import src="./item.rml" />
<div>
    <div r:for="{{items}}" r:key="title">
        <p>index: {{index}}</p>
        <template is="item" data="{{...item}}" />
    </div>
</div>

item.rml

<template name="item">
    <div>
        <p>title: {{title}}</p>
    </div>
</template>