ractive-html-loader

1.0.0 • Public • Published

Ractive HTML loader

Based on webpack-html-loader.

This loader parse Ractive templates Ractive into object template (via Ractive.parse) and resolves loadable resources.

Getting started

Install the package:

npm install --save-dev ractive-html-loader

Then add the loader to your webpack config. For example:

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.rhtml$/i,
        loader: 'ractive-html-loader',
        options: {
          /* ... */
        }
      },
    ],
  },
};

Then import template file in your code

import template from './file.rhtml';

const Cmp = Ractive.extend({
  template,
});

class Cmp extends Ractive { /* ... */ }

Ractive.extendWith(Cmp, {
  template,
});

Options

attrs

boolean | string | string[]

Default: ['img:src']

Specify what type of attribute of which tag must be as external file.

You may need to specify loaders for asset modules. See this guide.

e.g.:

['tag:attribute'] 'tag:attribute tag:attribute'

root

Base path for the resources

string

Default: undefined

parseOptions

Object

Default: undefined

params to be passed to Ractive.parse.

esModule

boolean

produce output using ES syntax

Default: true

TODO - FUTURE

  • improve attribute handling

Package Sidebar

Install

npm i ractive-html-loader

Weekly Downloads

32

Version

1.0.0

License

MIT

Unpacked Size

13.5 kB

Total Files

8

Last publish

Collaborators

  • marcalexiei