New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

html-node-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-node-loader

Webpack plugin for loading HTML files as DOM

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

HTML Node Loader is a loader for webpack that will load a given HTML file as DOM.

Installation

Using npm:

$ npm install html-node-loader --save-dev

Usage

In webpack.config.js:

module: {
    rules: [
        {
            test: /\.html$/i,
            use: [ {
                loader: 'html-node-loader',
                options: {
                    wrap: false
                }
            } ],
        },
    ]
}

In yor JS files you can now simply import the HTML file:

// index.js
import example from "example.html"

consol.log(example.innerText);
<!-- example.html -->
<p>Hello!</p>

Options

wrap: Will wrap the parsed html in a <span> (default: true)

NOTE: Setting wrap to false will return the firstChild of the span

Keywords

loader

FAQs

Package last updated on 08 Jul 2021

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