1.0.0 • Published 2 years ago

ractive-html-loader v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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
1.0.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.1.0

3 years ago