
Security News
Free Certified Patch for Critical Rails Active Storage Vulnerability
Socket has released a free Certified Patch for a critical Rails Active Storage vulnerability, giving developers time to upgrade to a secure Rails version.
svelte-remove-attributes-preprocessor
Advanced tools
Svelte / SvelteKit preprocessor to remove specified attributes (e.g., data-testid, data-cy) at build time. Supports spread syntax and can be enabled via environment variables.
Svelte / SvelteKit preprocessor to remove specified attributes (e.g., data-testid, data-cy) at build time. Supports spread syntax and can be enabled via environment variables.
data-testid){...props})pnpm add -D svelte-remove-attributes-preprocessor
Add the preprocessor to your svelte.config.js:
import { removeAttributesPreprocessor } from 'svelte-remove-attributes-preprocessor';
export default {
preprocess: [
removeAttributesPreprocessor({
attributes: ['data-testid']
})
]
};
Enable/disable attribute removal via environment variable:
import { removeAttributesPreprocessor } from 'svelte-remove-attributes-preprocessor';
export default {
preprocess: [
removeAttributesPreprocessor({
envVar: 'STRIP_ATTRIBUTES', // default: 'STRIP_ATTRIBUTES'
expected: '1', // default: '1'
attributes: ['data-testid']
})
]
};
Then set the environment variable when building:
STRIP_ATTRIBUTES=1 pnpm build
For SvelteKit, add it to vite.config.js or svelte.config.js:
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { removeAttributesPreprocessor } from 'svelte-remove-attributes-preprocessor';
export default defineConfig({
plugins: [sveltekit()],
// ... other config
});
// In svelte.config.js
import adapter from '@sveltejs/adapter-auto';
import { removeAttributesPreprocessor } from 'svelte-remove-attributes-preprocessor';
export default {
kit: {
adapter: adapter()
},
preprocess: [
removeAttributesPreprocessor({
attributes: ['data-testid']
})
]
};
| Option | Type | Default | Description |
|---|---|---|---|
attributes | string[] | [] | Array of attribute names to remove |
envVar | string | 'STRIP_ATTRIBUTES' | Environment variable name to check |
expected | string | '1' | Expected value for the environment variable |
// svelte.config.js
import { removeAttributesPreprocessor } from 'svelte-remove-attributes-preprocessor';
export default {
preprocess: [
removeAttributesPreprocessor({
attributes: ['data-testid', 'data-cy', 'data-test']
})
]
};
// Only remove attributes when STRIP_ATTRIBUTES=1
removeAttributesPreprocessor({
envVar: 'STRIP_ATTRIBUTES',
expected: '1',
attributes: ['data-testid']
})
FAQs
Svelte / SvelteKit preprocessor to remove specified attributes (e.g., data-testid, data-cy) at build time. Supports spread syntax and can be enabled via environment variables.
The npm package svelte-remove-attributes-preprocessor receives a total of 3 weekly downloads. As such, svelte-remove-attributes-preprocessor popularity was classified as not popular.
We found that svelte-remove-attributes-preprocessor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Socket has released a free Certified Patch for a critical Rails Active Storage vulnerability, giving developers time to upgrade to a secure Rails version.

Security News
/Threat Research
A malicious Ruby gem runs a credential-stealing worm during installation, poisons AI coding tools, and can wipe files when a stolen GitHub token is revoked.

Security News
GitHub is tightening GitHub Actions security with new restrictions on privileged pull request workflows. Here's what changes and how maintainers are affected.