{"id":24983727,"url":"https://github.com/posthtml/posthtml-postcss-merge-longhand","last_synced_at":"2025-04-11T20:52:37.012Z","repository":{"id":38844116,"uuid":"259276413","full_name":"posthtml/posthtml-postcss-merge-longhand","owner":"posthtml","description":"Merge longhand properties from inline CSS into shorthand with PostCSS.","archived":false,"fork":false,"pushed_at":"2025-04-11T15:28:43.000Z","size":1562,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T20:52:28.972Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/posthtml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":"posthtml","open_collective":"posthtml","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://mailviews.com"]}},"created_at":"2020-04-27T10:09:22.000Z","updated_at":"2025-04-03T10:52:59.000Z","dependencies_parsed_at":"2022-09-18T12:51:11.597Z","dependency_job_id":"8183a2b0-839b-426e-b24d-41396f35ab13","html_url":"https://github.com/posthtml/posthtml-postcss-merge-longhand","commit_stats":{"total_commits":164,"total_committers":3,"mean_commits":"54.666666666666664","dds":0.3414634146341463,"last_synced_commit":"057726cd871bd0633130e76fedf0f3c8758cb907"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-merge-longhand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-merge-longhand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-merge-longhand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-merge-longhand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-postcss-merge-longhand/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480515,"owners_count":21110936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-04T09:20:46.321Z","updated_at":"2025-04-11T20:52:36.989Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\r\n  \u003cimg width=\"150\" height=\"150\" title=\"PostHTML\" src=\"https://posthtml.github.io/posthtml/logo.svg\"\u003e\r\n  \u003ch1\u003eMerge Longhand\u003c/h1\u003e\r\n  \u003cp\u003eMerge longhand inline CSS into shorthand\u003c/p\u003e\r\n\r\n  [![Version][npm-version-shield]][npm]\r\n  [![Build][github-ci-shield]][github-ci]\r\n  [![License][license-shield]][license]\r\n  [![Downloads][npm-stats-shield]][npm-stats]\r\n\u003c/div\u003e\r\n\r\n## About\r\n\r\nThis plugin uses [postcss-merge-longhand](https://github.com/cssnano/cssnano/tree/master/packages/postcss-merge-longhand) to merge longhand CSS properties in `style=\"\"` attributes to shorthand.\r\n\r\nInput:\r\n\r\n```html\r\n\u003cdiv style=\"margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;\"\u003eTest\u003c/div\u003e\r\n```\r\n\r\nOutput:\r\n\r\n```html\r\n\u003cdiv style=\"margin: 1px 2px 3px 4px;\"\u003eTest\u003c/div\u003e\r\n```\r\n\r\n## Install\r\n\r\n```\r\n$ npm i posthtml posthtml-postcss-merge-longhand\r\n```\r\n\r\n## Usage\r\n\r\n```js\r\nimport posthtml from 'posthtml'\r\nimport mergeInlineLonghand from 'posthtml-postcss-merge-longhand'\r\n\r\nconst html = '\u003cdiv style=\"margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;\"\u003eTest\u003c/div\u003e'\r\n\r\nposthtml([\r\n    mergeInlineLonghand()\r\n  ])\r\n  .process(html)\r\n  .then(result =\u003e console.log(result.html))\r\n\r\n  // \u003cdiv style=\"margin: 1px 2px 3px 4px;\"\u003eTest\u003c/div\u003e\r\n```\r\n\r\n### CommonJS\r\n\r\nBoth ESM and CJS exports are provided, you can also `require` the module:\r\n\r\n```js\r\nconst posthtml = require('posthtml')\r\nconst mergeInlineLonghand = require('posthtml-postcss-merge-longhand')\r\n\r\n// ...\r\n```\r\n\r\n## Options\r\n\r\n### `tags`\r\n\r\nType: `array`\\\r\nDefault: `[]`\r\n\r\nArray of tag names to process. All other tags will be skipped.\r\n\r\nExample:\r\n\r\n```js\r\nimport posthtml from 'posthtml'\r\nimport mergeInlineLonghand from 'posthtml-postcss-merge-longhand'\r\n\r\nconst html = `\r\n  \u003cdiv style=\"margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;\"\u003eTest\u003c/div\u003e\r\n  \u003cp style=\"margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;\"\u003eTest\u003c/p\u003e\r\n`\r\n\r\nposthtml([\r\n    mergeInlineLonghand({tags: ['div']})\r\n  ])\r\n  .process(html)\r\n  .then(result =\u003e console.log(result.html))\r\n\r\n  // \u003cdiv style=\"margin: 1px 2px 3px 4px;\"\u003eTest\u003c/div\u003e\r\n  // \u003cp style=\"margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;\"\u003eTest\u003c/p\u003e\r\n```\r\n\r\n[npm]: https://www.npmjs.com/package/posthtml-postcss-merge-longhand\r\n[npm-version-shield]: https://img.shields.io/npm/v/posthtml-postcss-merge-longhand.svg\r\n[npm-stats]: http://npm-stat.com/charts.html?package=posthtml-postcss-merge-longhand\r\n[npm-stats-shield]: https://img.shields.io/npm/dt/posthtml-postcss-merge-longhand.svg\r\n[github-ci]: https://github.com/posthtml/posthtml-postcss-merge-longhand/actions\r\n[github-ci-shield]: https://github.com/posthtml/posthtml-postcss-merge-longhand/actions/workflows/nodejs.yml/badge.svg\r\n[license]: ./LICENSE\r\n[license-shield]: https://img.shields.io/npm/l/posthtml-postcss-merge-longhand.svg\r\n","funding_links":["https://patreon.com/posthtml","https://opencollective.com/posthtml","https://mailviews.com"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-postcss-merge-longhand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-postcss-merge-longhand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-postcss-merge-longhand/lists"}