Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mithril-render-loader

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mithril-render-loader

> [webpack-Loader](https://webpack.js.org/) to render a [mithril](https://mithril.js.org/) [component](https://mithril.js.org/components.html) to html

  • 0.7.0
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

mithril-render-loader

webpack-Loader to render a mithril component to html

install npm install mithril-render-loader --save-dev

requirements node v6+

Options

optiontypedefaultdescription
modelMixed{}required data for component. Pass as vnode.attrs
exportBooleanfalseexport using module.exports or return a string (html-loader)
cacheableBooleantruedeactivate cache, forcing a complete rebuild each time
profileBooleanfalselog render times to console
escapeAttributesFunctionBooleanfalse
escapeStringFunctionBooleanfalse
strictBooleanfalseRender the html as xml/xhtml

Usage Example

The index.view.js

    const m = require("mithril");
    const View = {
        view(vnode) {
            const data = vnode.attrs.model;
            return m("Hello User");
        }
    }

The webpack-config might look something along theese lines:

{

    entry: "./test/app/index.view.js",
    resolve: {
        modules: [".", "node_modules"]
    },
    output: {
        path: path.join(__dirname, "build")
    },
    module: {
        rules: [
            {
                test: [
                    path.join(__dirname, "test", "app", "index.view.js")
                ],
                use: [
                    {
                        loader: "file-loader",
                        options: {
                            name: "index.html"
                        }
                    },
                    {
                        loader: "extract-loader"
                    },
                    {
                        loader: "html-loader",
                        options: {
                            minimize: false, // deactivate minimize. It destroys valid inline css syntax
                            interpolate: false,
                            minifyCSS: false, // bugged
                            root: __dirname
                        }
                    },
                    {
                        loader: "mithril-render-loader",
                        options: {
                            model: {
                                title: "mithril-render-loader testpage",
                                items: [
                                    "compiles mithril component to html",
                                    "watches file changes"
                                ]
                            }
                        }
                    }
                ]
            }
        ]
    }
};

If the html-loader is omitted and mithril-render-loader should export a string, add the option export: true

FAQs

Package last updated on 01 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc