Neural Processing Mechanisms

    userscript-metadata-webpack-plugin

    0.1.0 • Public • Published

    userscript-metadata-webpack-plugin

    userscript-metadata-webpack-plugin is a webpack plugin to generate userscript metadata and prepend to file which name matched *.user.js

    when using webpack 4, install userscript-metadata-webpack-plugin==0.0.6

    usage

    install

    npm i userscript-metadata-webpack-plugin -D

    configure

    webpack.config.js

    const pkg = require('../package.json')
    const UserScriptMetaDataPlugin = require('userscript-metadata-webpack-plugin')
    
    let metadata = {
      'name': 'UserScript name' || pkg.name,
      'name:zh': '用户脚本名',
      'namespace': pkg.repository.url,
      'version': pkg.version,
      'author': pkg.author, // could be a object { name , email } or string
      'source': pkg.repository.url,
      'license': pkg.license,
      'match': [
        'www.google.com'
      ],
      'require': [
        'https://code.jquery.com/jquery-3.3.1.min.js',
      ],
      'grant': [
        'GM_xmlhttpRequest',
      ],
      'connect': [
        'localhost',
        'www.google.com'
      ],
      'run-at': 'document-end'
    }
    
    const config = {
      // ...
      // ...
      plugins: [
        new UserScriptMetaDataPlugin({
          metadata
        })
      ]
    }
    
    module.exports = config

    Install

    npm i userscript-metadata-webpack-plugin

    DownloadsWeekly Downloads

    28

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    8.48 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar