{"id":19653046,"url":"https://github.com/csstools/postcss-to-nest","last_synced_at":"2025-04-28T17:31:16.493Z","repository":{"id":57328607,"uuid":"50428126","full_name":"csstools/postcss-to-nest","owner":"csstools","description":"Transform unnested CSS into nested CSS","archived":true,"fork":false,"pushed_at":"2016-01-26T12:59:06.000Z","size":63,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-21T21:38:50.033Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jonathantneal.github.io/postcss-to-nest/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csstools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-26T12:45:49.000Z","updated_at":"2024-10-23T21:19:00.000Z","dependencies_parsed_at":"2022-09-15T12:40:45.677Z","dependency_job_id":null,"html_url":"https://github.com/csstools/postcss-to-nest","commit_stats":null,"previous_names":["jonathantneal/postcss-to-nest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-to-nest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-to-nest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-to-nest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-to-nest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csstools","download_url":"https://codeload.github.com/csstools/postcss-to-nest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251216005,"owners_count":21553913,"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":"2024-11-11T15:13:00.831Z","updated_at":"2025-04-28T17:31:16.454Z","avatar_url":"https://github.com/csstools.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSS To Nest\n\n\u003ca href=\"https://github.com/postcss/postcss\"\u003e\u003cimg src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"80\" height=\"80\" align=\"right\"\u003e\u003c/a\u003e\n\n[![NPM Version][npm-img]][npm] [![Build Status][ci-img]][ci]\n\n[CSS To Nest] transforms unnested CSS into nested CSS, following the [CSS Nesting Module] specification. This might be helpful for updating a project with a single file of legacy CSS.\n\n```css\n/* before */\n.foo .bar {\n\tcolor: blue;\n}\n\n.foo .bar .pre.mon {\n\tcolor: white;\n}\n\n.foo .bar .pre {\n\tcolor: red;\n}\n\n/* after */\n.foo {\n\t@nest \u0026 .bar {\n\t\tcolor: blue;\n\n\t\t@nest \u0026 .pre {\n\t\t\tcolor: red;\n\n\t\t\t@nest \u0026.mon {\n\t\t\t\tcolor: white;\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n## Usage\n\nAdd [CSS To Nest] to your build tool:\n\n```bash\nnpm install postcss-to-nest --save-dev\n```\n\n#### Node\n\n```js\nrequire('postcss-to-nest').process(YOUR_CSS, { /* options */ });\n```\n\n#### PostCSS\n\nAdd [PostCSS] to your build tool:\n\n```bash\nnpm install postcss --save-dev\n```\n\nLoad [CSS To Nest] as a PostCSS plugin:\n\n```js\npostcss([\n\trequire('postcss-to-nest')({ /* options */ })\n]).process(YOUR_CSS, /* options */);\n```\n\n#### Gulp\n\nAdd [Gulp PostCSS] to your build tool:\n\n```bash\nnpm install gulp-postcss --save-dev\n```\n\nEnable [CSS To Nest] within your Gulpfile:\n\n```js\nvar postcss = require('gulp-postcss');\n\ngulp.task('css', function () {\n\treturn gulp.src('./src/*.css').pipe(\n\t\tpostcss([\n\t\t\trequire('postcss-to-nest')({ /* options */ })\n\t\t])\n\t).pipe(\n\t\tgulp.dest('.')\n\t);\n});\n```\n\n#### Grunt\n\nAdd [Grunt PostCSS] to your build tool:\n\n```bash\nnpm install grunt-postcss --save-dev\n```\n\nEnable [CSS To Nest] within your Gruntfile:\n\n```js\ngrunt.loadNpmTasks('grunt-postcss');\n\ngrunt.initConfig({\n\tpostcss: {\n\t\toptions: {\n\t\t\tuse: [\n\t\t\t\trequire('postcss-to-nest')({ /* options */ })\n\t\t\t]\n\t\t},\n\t\tdist: {\n\t\t\tsrc: '*.css'\n\t\t}\n\t}\n});\n```\n\n[ci]:      https://travis-ci.org/jonathantneal/postcss-to-nest\n[ci-img]:  https://img.shields.io/travis/jonathantneal/postcss-to-nest.svg\n[npm]:     https://www.npmjs.com/package/postcss-to-nest\n[npm-img]: https://img.shields.io/npm/v/postcss-to-nest.svg\n\n[Gulp PostCSS]:  https://github.com/postcss/gulp-postcss\n[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss\n[PostCSS]:       https://github.com/postcss/postcss\n\n[CSS Nesting Module]: https://tabatkins.github.io/specs/css-nesting/\n\n[CSS To Nest]: https://github.com/jonathantneal/postcss-to-nest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fpostcss-to-nest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsstools%2Fpostcss-to-nest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fpostcss-to-nest/lists"}