Socket
Socket
Sign inDemoInstall

content-inject-plugin

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    content-inject-plugin

a plugin for html-webpack-plugin,which can inject static file content into html page


Version published
Maintainers
1
Created

Readme

Source

content-inject-plugin

a plugin for html-webpack-plugin,which can inject static file content into html page

Usage

var ContentInjectPlugin = require('./plugins/contentInjectPlugin');

new ContentInjectPlugin({
    contents:{
        content: 'this is inject content',
        rem: function(){
            return fs.readFileSync('./src/static/js/rem.js',{encoding:'utf8'});
        },
        other: 'other file content'
    },
    replaceMode: 'all',
    memo: true
})

in template

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>template</title>
        <meta charset="utf-8">
        <meta name="hotcss" content="design-width=750">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta content="black" name="apple-mobile-web-app-status-bar-style">
        <meta content="telephone=no" name="format-detection">
        <script>
        {{{__rem__}}}
        </script>
        <script>
        {{{__other__}}}
        </script>
    </head>
    <body>
        <div id="app">
        </div>
        {{{__other__}}}
    </body>
</html>

Params

ParameterTypeDefaultOptionsDescription
contentsarraythe content's array, which key used by tag in template, like {{{__key__}}}, support function to get content
replaceModestringallall,firstreplace all matches or the first match
memobooleanmemorize the content or not

Note

In tempalte, content tag, which want to inject into head, must use legal tag like

Keywords

FAQs

Last updated on 07 May 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc