Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

damianstasik/vue-data-attr-remover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published