{"name":"postcss-html","version":"1.8.1","keywords":["postcss","syntax","html","vue","quickapp","PHP","css","less","sass","scss","sss","sugarss"],"author":{"name":"gucong"},"license":"MIT","_id":"postcss-html@1.8.1","maintainers":[{"name":"jeddy3","email":"npm@richardhallows.com"},{"name":"ai","email":"andrey@sitnik.ru"},{"name":"gucong","email":"gucong@gmail.com"},{"name":"ota-meshi","email":"otameshiyo23@gmail.com"}],"contributors":[{"url":"https://github.com/ota-meshi","name":"Yosuke Ota"}],"homepage":"https://github.com/ota-meshi/postcss-html#readme","bugs":{"url":"https://github.com/ota-meshi/postcss-html/issues"},"nyc":{"cache":true,"reporter":["lcov","text"],"check-coverage":true},"dist":{"shasum":"111eba62cfc293e38a3ffe64d4caf9c830ea2c42","tarball":"http://registry-npm.ywwl.com/postcss-html/download/postcss-html-1.8.1.tgz","fileCount":19,"integrity":"sha512-OLF6P7qctfAWayOhLpcVnTGqVeJzu2W3WpIYelfz2+JV5oGxfkcEvweN9U4XpeqE0P98dcD9ssusGwlF0TK0uQ==","signatures":[{"sig":"MEUCIC2KMQRu0tqlCDXfCmByLnprES0vFmmg9ReR0TazK6BxAiEAwPjxn3RwTmXJu2S3ug80RUsve0PSiOq9WHLDsuXHDSU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/postcss-html@1.8.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":28303,"size":9430,"noattachment":false,"key":"/postcss-html/-/postcss-html-1.8.1.tgz"},"main":"./lib/index.js","types":"./lib/index.d.ts","engines":{"node":"^12 || >=14"},"gitHead":"61860dc0d83302af5b31d24cc61fff795d58caa7","scripts":{"lint":"eslint .","test":"nyc npm run mocha","mocha":"mocha \"test/**/*.js\" --no-timeouts","eslint-fix":"eslint . --fix","preversion":"npm run test","update-snap":"mocha \"test/**/*.js\" --no-timeouts --update"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fedf4da3-bc2c-420c-9526-9d820963739f"}},"repository":{"url":"git+https://github.com/ota-meshi/postcss-html.git","type":"git"},"_npmVersion":"11.6.2","description":"PostCSS syntax for parsing HTML (and HTML-like)","directories":{},"_nodeVersion":"24.12.0","dependencies":{"postcss":"^8.5.0","js-tokens":"^9.0.0","htmlparser2":"^8.0.0","postcss-safe-parser":"^6.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.0.0","chai":"~4.5.0","mocha":"^10.0.0","eslint":"^8.0.1","codecov":"^3.8.3","sugarss":"^5.0.0","prettier":"^3.0.0","stylelint":"^14.4.0","autoprefixer":"^10.3.7","postcss-less":"^6.0.0","postcss-scss":"^4.0.1","postcss-styl":"^0.12.0","eslint-plugin-n":"^17.0.0","eslint-plugin-vue":"^9.0.0","eslint-plugin-yml":"^1.0.0","eslint-plugin-jsonc":"^2.0.0","eslint-plugin-regexp":"^2.0.0","eslint-config-prettier":"^10.0.0","eslint-plugin-prettier":"^5.0.0","@ota-meshi/eslint-plugin":"^0.15.0","mocha-chai-jest-snapshot":"1.1.3","stylelint-config-standard":"^28.0.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-node-dependencies":"^0.13.0","eslint-plugin-json-schema-validator":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/postcss-html_1.8.1_1768315110389_0.19623496737171098","host":"s3://npm-registry-packages-npm-production"},"readme":"# PostCSS HTML Syntax\n\n[![NPM license](https://img.shields.io/npm/l/postcss-html.svg)](https://www.npmjs.com/package/postcss-html)\n[![NPM version](https://img.shields.io/npm/v/postcss-html.svg?style=flat-square)](https://www.npmjs.com/package/postcss-html)\n[![NPM downloads](https://img.shields.io/npm/dw/postcss-html.svg)](http://www.npmtrends.com/postcss-html)\n[![NPM downloads](https://img.shields.io/npm/dm/postcss-html.svg)](http://www.npmtrends.com/postcss-html)\n[![NPM downloads](https://img.shields.io/npm/dy/postcss-html.svg)](http://www.npmtrends.com/postcss-html)\n[![Build Status](https://github.com/ota-meshi/postcss-html/workflows/CI/badge.svg?branch=master)](https://github.com/ota-meshi/postcss-html/actions?query=workflow%3ACI)\n\n<img align=\"right\" width=\"95\" height=\"95\"\n title=\"Philosopher’s stone, logo of PostCSS\"\n src=\"http://postcss.github.io/postcss/logo.svg\">\n\n[PostCSS](https://github.com/postcss/postcss) syntax for parsing HTML (and HTML-like)\n\n- [Vue Single-File Components](https://vuejs.org/guide/scaling-up/sfc.html)\n- [Svelte Components](https://svelte.dev/docs#component-format)\n- [Astro Components](https://docs.astro.build/en/core-concepts/astro-components/)\n- [PHP](http://php.net)\n- [Quick App](https://doc.quickapp.cn/framework/source-file.html)\n- [XSLT](https://www.w3.org/TR/xslt-30/)\n\n## Getting Started\n\nFirst thing's first, install the module:\n\n```bash\nnpm install postcss-html --save-dev\n```\n\npostcss-html is an ES module and requires Node.js `^22.12 || >=24`. CommonJS consumers on those Node.js versions can still load it with `require(\"postcss-html\")`.\n\nIf you want support SCSS/SASS/LESS/SugarSS syntax, you need to install the corresponding module.\n\n- SCSS: [postcss-scss](https://github.com/postcss/postcss-scss)\n- SASS: [postcss-sass](https://github.com/aleshaoleg/postcss-sass)\n- LESS: [postcss-less](https://github.com/shellscape/postcss-less)\n- SugarSS: [sugarss](https://github.com/postcss/sugarss)\n- Stylus: [postcss-styl](https://github.com/ota-meshi/postcss-styl)\n\n## Use Cases\n\n```js\nimport postcss from 'postcss';\nimport postcssHtml from 'postcss-html';\nimport postcssScss from 'postcss-scss';\nimport postcssLess from 'postcss-less';\nimport postcssSafeParser from 'postcss-safe-parser';\n\nconst syntax = postcssHtml({\n    // syntax for parse scss (non-required options)\n    scss: postcssScss,\n    // syntax for parse less (non-required options)\n    less: postcssLess,\n    // syntax for parse css blocks (non-required options)\n    css: postcssSafeParser,\n});\npostcss(plugins).process(source, { syntax: syntax }).then(function (result) {\n    // An alias for the result.css property. Use it with syntaxes that generate non-CSS output.\n    result.content\n});\n```\n\nIf you want support SCSS/SASS/LESS/SugarSS syntax, you need to install these module:\n\n- SCSS: [postcss-scss](https://github.com/postcss/postcss-scss)\n- SASS: [postcss-sass](https://github.com/aleshaoleg/postcss-sass)\n- LESS: [postcss-less](https://github.com/shellscape/postcss-less)\n- SugarSS: [sugarss](https://github.com/postcss/sugarss)\n- Stylus: [postcss-styl](https://github.com/ota-meshi/postcss-styl)\n\n## Advanced Use Cases\n\n### Options\n\n```js\nimport postcssHtml from 'postcss-html';\nimport postcssSass from 'postcss-sass';\nimport sugarss from 'sugarss';\nimport postcssCustomSyntax from 'postcss-custom-syntax';\n\nconst options = {\n    rules: [\n        {\n            // custom language\n            test: /^postcss$/i,\n            lang: 'scss'\n        },\n        {\n            // custom language\n            test: /^customcss$/i,\n            lang: 'custom'\n        },\n    ],\n\n    // custom parser for CSS (using `postcss-safe-parser`)\n    css: 'postcss-safe-parser',\n    // custom parser for SASS (PostCSS-compatible syntax.)\n    sass: postcssSass,\n    // custom parser for SCSS (by module name)\n    scss: 'postcss-scss',\n    // custom parser for LESS (by module path)\n    less: './node_modules/postcss-less',\n    // custom parser for SugarSS\n    sugarss: sugarss,\n    // custom parser for custom language\n    custom: postcssCustomSyntax,\n}\nconst syntax = postcssHtml(options);\n```\n\n## Turning PostCSS off from within your HTML\n\nPostCSS can be temporarily turned off by using special comments in your HTML. For example:\n\n```html\n<html>\n<body>\n<!-- postcss-ignore -->\n<a style=\"color: red;\" description=\"style is not parsed.\"></a>\n\n<a style=\"color: red;\" description=\"style is parsed.\"></a>\n```\n\n```html\n<html>\n<body>\n<!-- postcss-disable -->\n<a style=\"color: red;\" description=\"style is not parsed.\"></a>\n<a style=\"color: red;\" description=\"style is not parsed.\"></a>\n<!-- postcss-enable -->\n\n<a style=\"color: red;\" description=\"style is parsed.\"></a>\n```\n\n## Linting with Stylelint\n\nThe main use case of this plugin is to apply linting with [Stylelint] to `<style>` tags and `<div style=\"*\">` property in HTML (and HTML-like).\n\nYou can use it by configuring your `stylelint` config as follows:\n\n```json\n{\n    \"overrides\": [\n        {\n            \"files\": [\"*.html\", \"**/*.html\"],\n            \"customSyntax\": \"postcss-html\"\n        }\n    ]\n}\n```\n\nYou can use it more easily if you use an already configured sharable config.\n\n```diff\n{\n+    \"extends\": [\n+        \"stylelint-config-html\",\n         // If you are using Vue.\n+        \"stylelint-config-recommended-vue\"\n+    ],\n-    \"overrides\": [\n-        {\n-            \"files\": [\"*.html\", \"**/*.html\"],\n-            \"customSyntax\": \"postcss-html\"\n-        }\n-    ]\n}\n```\n\n- [stylelint-config-html]\n- [stylelint-config-recommended-vue]\n\n[Stylelint]: https://stylelint.io/\n[stylelint-config-html]: https://github.com/ota-meshi/stylelint-config-html\n[stylelint-config-recommended-vue]: https://github.com/ota-meshi/stylelint-config-recommended-vue\n","publish_time":1768315110599,"_cnpm_publish_time":1768315110599,"dist-tags":{"latest":"2.0.0","next":"1.0.0-alpha.4"}}