Skip to content

Commit

Permalink
feat: disable filters
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Oct 21, 2022
1 parent cd9d629 commit 1ca9728
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/transformers/filters/index.js
Expand Up @@ -8,6 +8,10 @@ const safeClassNames = require('posthtml-safe-class-names')
const defaultConfig = require('../../generators/posthtml/defaultConfig')

module.exports = async (html, config = {}, direct = false) => {
if (get(config, 'filters') === false) {
return html
}

const filters = direct ?
merge(defaultFilters, config) :
merge(defaultFilters, get(config, 'filters', {}))
Expand Down
6 changes: 6 additions & 0 deletions test/test-transformers.js
Expand Up @@ -361,6 +361,12 @@ test('filters (default)', async t => {
t.is(html, await expected('filters'))
})

test('filters (disabled)', async t => {
const html = await Maizzle.withFilters('<p uppercase>test</p>', {filters: false})

t.is(html, '<p uppercase>test</p>')
})

test('filters (tailwindcss)', async t => {
const html = await Maizzle.withFilters(
`<style tailwindcss>
Expand Down

0 comments on commit 1ca9728

Please sign in to comment.