1. strip-literal
Strip comments and string literals from JavaScript code
strip-literal
Package: strip-literal
Created by: antfu
Last modified: Fri, 29 Mar 2024 10:24:48 GMT
Version: 2.1.0
License: MIT
Downloads: 18,776,314
Repository: https://github.com/antfu/strip-literal

Install

npm install strip-literal
yarn add strip-literal

strip-literal

NPM version

Strip comments and string literals from JavaScript code. Powered by js-tokens.

Usage

 import { stripLiteral } from 'strip-literal'

stripLiteral('const foo = `//foo ${bar}`') // 'const foo = `       ${bar}`'

Comments, string literals will be replaced by spaces with the same length to keep the source map untouched.

Sponsors

License

MIT License © 2022 Anthony Fu

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin