npm.io
0.1.0 • Published 7 years ago

vue-data-attr-remover

Licence
MIT
Version
0.1.0
Deps
0
Size
56 kB
Vulns
0
Weekly
0
Stars
2

vue-data-attr-remover

Vue compiler module that allows you to easily remove data-* attributes

Instalation

npm i -D vue-data-attr-remover

yarn add --dev vue-data-attr-remover

Usage

vue.config.js
const dataAttrRemover = require('vue-data-attr-remover');

module.exports = {
  chainWebpack(config) {
    config.module
      .rule('vue')
      .use('vue-loader')
      .tap((options) => {
        const { compilerOptions } = options;
        const { modules = [] } = compilerOptions;

        modules.push(dataAttrRemover());

        compilerOptions.modules = modules;
        options.compilerOptions = compilerOptions;

        return options;
      });
  }
};
webpack.config.js
const dataAttrRemover = require('vue-data-attr-remover');

module.exports = {
  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          compilerOptions: {
            modules: [
              dataAttrRemover(),
            ],
          },
        },
      },
    ],
  },
};

API

Name Type Default value
condition Function () => process.env.NODE_ENV === 'production'
onlyExactAttrName Boolean true
attrNameSuffix String 'test'

Keywords