{"id":13798810,"url":"https://github.com/HowlingEverett/koa-postcss","last_synced_at":"2025-05-13T06:31:36.539Z","repository":{"id":143882841,"uuid":"43535452","full_name":"HowlingEverett/koa-postcss","owner":"HowlingEverett","description":"Caching PostCSS middleware for Koa.js","archived":false,"fork":false,"pushed_at":"2016-02-03T05:25:15.000Z","size":14,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T16:12:49.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HowlingEverett.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-02T04:13:30.000Z","updated_at":"2016-05-08T10:59:24.000Z","dependencies_parsed_at":"2023-04-25T19:23:25.112Z","dependency_job_id":null,"html_url":"https://github.com/HowlingEverett/koa-postcss","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HowlingEverett%2Fkoa-postcss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HowlingEverett%2Fkoa-postcss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HowlingEverett%2Fkoa-postcss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HowlingEverett%2Fkoa-postcss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HowlingEverett","download_url":"https://codeload.github.com/HowlingEverett/koa-postcss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253888880,"owners_count":21979522,"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-08-04T00:00:54.321Z","updated_at":"2025-05-13T06:31:36.247Z","avatar_url":"https://github.com/HowlingEverett.png","language":"JavaScript","readme":"# PostCSS Koa Middleware\n\nThis middleware runs source CSS through a PostCSS plugin pipeline, and caches the results,\nre-running only when you've udpated the source files.\n\n## Installation\n\nkoa-postcss is available on npm:\n\n```\nnpm install koa-postcss postcss\n```\n\n*Note:* PostCSS is a peer dependency, so you control what version to install\ninto your project. However, koa-postcss only supports PostCSS \u003e5.0.\n\n## Usage\n\nLoad koa-postcss as with any other koa middleware. Pass a source directory from\nwhich to resolve your source files, the plugins you want to use to process your \nCSS, and a destination directory. If you're using `@import` in your source CSS \nfiles (i.e. via postcss-import or cssnext), modifying imports will trigger a \nrecompile.\n\nThe middleware will only apply to requests directly to a CSS file. It resolves\nby looking for an input CSS file in your `src` directory that matches the\nfilename of the CSS file on the request. E.g. requesting /public/css/main.css\nin your app will cause the middleware to attempt to process\n`/my/source/dir/main.css`.\n\nYou'll also want to use a static file middleware to serve the processed CSS.\n\n```node\nvar koa = require('koa');\nvar postcss = require('koa-postcss');\nvar cssImport = require('postcss-import');\nvar autoprefixer = require('autoprefixer');\nvar serve = require('koa-static');\n\nvar app = koa();\n\n// koa-postcss middleware. src, dest, and plugins are all required\napp.use(postcss({\n    src: './src/css',\n    dest: './public/css',\n    plugins: [\n        cssImport(),\n        autoprefixer({browsers: ['last 2 versions']})\n    ]\n}));\napp.use(serve('./public'));\n\n// GET requests will now recompile /src/css/main.css to /public/css/main.css\n// whenever the source file changes, or any of its imports change.\n\n```\n","funding_links":[],"categories":["仓库"],"sub_categories":["中间件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHowlingEverett%2Fkoa-postcss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHowlingEverett%2Fkoa-postcss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHowlingEverett%2Fkoa-postcss/lists"}