npm

Get private packages and team management tools with npm Orgs.Learn more »

html-inject-snippet-loader

1.0.3 • Public • Published

安装使用

    npm install html-inject-snippet-loader --save-dev
{
    test:'html',
    use:[{
        'loader':'html-inject-snippet-loader',
        options:{
            snippets:[
                { 
                    //required 要匹配的标签名
                    tag:tagName, 
                    //optional, true for openTag or false for closeTag.
                    //default openTag
                    isOpenTag:true, 
                    //optional, true for all and false for the first match
                    //default: just first tag
                    global: false, 
                    /**
                    * matchTagContent and snippet
                    * action = 'append'   matchTagContent + snippet
                    * action = 'prepend'  snippent + matchTagContent
                    * default ''
                    * if action not set,
                    * when isOpenTag is true, default value is 'append'
                    * when isOpenTag is false, default Value is 'prepend'
                    **/
                    action:'', //optional. 
                    snippet:'',//required the inject snippet code
                },
                //*for example
                // source code '<head>test</head>
                
                //result: <head>headInjecttest</head>
                {
                    tag:'head',
                    snippet:'headInject'
                },
                
                //result: <head>testheadInject</head>
                {
                    tag:'head',
                    isOpenTag:false
                    snippet:'headInject
                },
                //result:headInject<head>test</test>
                {   
                    tag:'head',
                    snippet:'headInject',
                    action:'prepend'
                },
                //result:<head>test</test>headInject
                {
                    tag:'head',
                    isOpenTag:false
                    snippet:'headInject',
                    action:'append'
                }
            ]    
        }
    }]
}

Keywords

none

install

npm i html-inject-snippet-loader

Downloadsweekly downloads

3

version

1.0.3

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability