{"id":27373984,"url":"https://github.com/arccoza/metalsmith-with-postcss","last_synced_at":"2025-04-13T11:36:09.113Z","repository":{"id":57295716,"uuid":"55394221","full_name":"arccoza/metalsmith-with-postcss","owner":"arccoza","description":"A Metalsmith plugin for PostCSS.","archived":false,"fork":false,"pushed_at":"2019-01-25T03:01:47.000Z","size":14,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T01:50:39.451Z","etag":null,"topics":["metalsmith","postcss"],"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/arccoza.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-04T07:56:31.000Z","updated_at":"2023-02-10T22:59:38.000Z","dependencies_parsed_at":"2022-08-30T22:30:35.524Z","dependency_job_id":null,"html_url":"https://github.com/arccoza/metalsmith-with-postcss","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arccoza%2Fmetalsmith-with-postcss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arccoza%2Fmetalsmith-with-postcss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arccoza%2Fmetalsmith-with-postcss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arccoza%2Fmetalsmith-with-postcss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arccoza","download_url":"https://codeload.github.com/arccoza/metalsmith-with-postcss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248707617,"owners_count":21148921,"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":["metalsmith","postcss"],"created_at":"2025-04-13T11:36:08.463Z","updated_at":"2025-04-13T11:36:09.110Z","avatar_url":"https://github.com/arccoza.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Metalsmith with PostCSS\r\n\r\nA Metalsmith plugin for [PostCSS](https://github.com/postcss/postcss/).\r\n\r\n## Explanation\r\nUse PostCSS and PostCSS plugins with Metalsmith.\r\n\r\nYou mustn't forget to install the PostCSS plugins with `npm install` first.\r\n\r\n## Install\r\n\r\n`npm install metalsmith-with-postcss --save`\r\n\r\n## Example\r\n\r\nmetalsmith.json config example:\r\n```js\r\n{\r\n  \"plugins\": {\r\n    \"metalsmith-with-postcss\": {\r\n      pattern: ['**/*.css', '!**/_*/*', '!**/_*'], //This is the default.\r\n      plugins: {\r\n        'postcss-import': {},\r\n        'postcss-if-media': {},\r\n        'postcss-custom-media': {},\r\n        'postcss-media-minmax': {},\r\n        'postcss-layout': {},\r\n        'postcss-aspect-ratio': {},\r\n        'autoprefixer': {}\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nBuild script example:\r\n```js\r\nvar metalsmith = require('metalsmith');\r\nvar markdown = require('metalsmith-markdown');\r\nvar postcss = require('metalsmith-with-postcss');\r\nvar sugarss = require('sugarss');\r\nvar rename = require('metalsmith-rename';\r\n\r\n\r\nmetalsmith(__dirname)\r\n  .source('src')\r\n  .destination('pub')\r\n  .use(postcss({\r\n    pattern: ['**/*.sss', '!**/_*/*', '!**/_*'], //For SugarSS,\r\n    parser: sugarss,\r\n    plugins: {\r\n      'postcss-import': {},\r\n      'postcss-if-media': {},\r\n      'postcss-custom-media': {},\r\n      'postcss-media-minmax': {},\r\n      'postcss-layout': {},\r\n      'postcss-aspect-ratio': {},\r\n      'autoprefixer': {}\r\n    }\r\n  }))\r\n  .use(rename([[/\\.sss$/, '.css']])) //Renames processed files to CSS\r\n  .use(markdown({\r\n    gfm: true,\r\n    tables: true\r\n  }))\r\n  .build(function (err) {\r\n    if (err) {\r\n      throw err;\r\n    }\r\n  });\r\n  \r\n```\r\n\r\n## Options\r\n\r\n| Option | Default Value | Description |\r\n| -----: | ------------- | ----------- |\r\n| `pattern`       | `['**/*.css', '!**/_*/*', '!**/_*']` | Only process files that match this pattern, can be an array of multiple patterns, following [multimatch](https://github.com/sindresorhus/multimatch) rules. The default patterns exclude any files or folders prefixed with an underscore. |\r\n| `parser`        | `undefined`     |   A [custom parser module](http://api.postcss.org/global.html#processOptions) passed directly to PostCSS. |\r\n| `stringifier`    | `undefined`     |   A [custom stringifier module](http://api.postcss.org/global.html#processOptions) passed directly to PostCSS. | \r\n| `syntax`        | `undefined`     |   A [shorthand object for the parser and stringifier](http://api.postcss.org/global.html#processOptions) passed directly to PostCSS. | \r\n| `plugins`       | `{}`           |   A collection of plugin module names as keys and any options for them as values. | \r\n| `map`          | `{inline: true}`  |  [Source mapping](https://github.com/postcss/postcss/blob/master/docs/source-maps.md) options passed directly to PostCSS. | \r\n| `removeExcluded` | `false`         |   If `true`, remove the files from metalsmith that were excluded by the `pattern`, so they won't appear in your build directory. | If `true`, remove the files from metalsmith that were excluded by the `pattern`, so they won't appear in your build directory.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farccoza%2Fmetalsmith-with-postcss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farccoza%2Fmetalsmith-with-postcss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farccoza%2Fmetalsmith-with-postcss/lists"}