{"id":19745004,"url":"https://github.com/gorriecoe/postcss-functions-lite","last_synced_at":"2026-05-14T15:33:48.893Z","repository":{"id":57328049,"uuid":"307242834","full_name":"gorriecoe/postcss-functions-lite","owner":"gorriecoe","description":"PostCSS plugin for exposing JavaScript functions.","archived":false,"fork":false,"pushed_at":"2020-10-30T01:33:04.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-11T06:05:35.317Z","etag":null,"topics":["postcss","postcss-functions"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gorriecoe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"ko_fi":"gorrie"}},"created_at":"2020-10-26T02:36:20.000Z","updated_at":"2021-01-01T14:09:53.000Z","dependencies_parsed_at":"2022-09-18T10:20:19.375Z","dependency_job_id":null,"html_url":"https://github.com/gorriecoe/postcss-functions-lite","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/gorriecoe%2Fpostcss-functions-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorriecoe%2Fpostcss-functions-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorriecoe%2Fpostcss-functions-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorriecoe%2Fpostcss-functions-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gorriecoe","download_url":"https://codeload.github.com/gorriecoe/postcss-functions-lite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241077071,"owners_count":19905718,"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":["postcss","postcss-functions"],"created_at":"2024-11-12T02:01:56.785Z","updated_at":"2026-05-14T15:33:48.851Z","avatar_url":"https://github.com/gorriecoe.png","language":"JavaScript","funding_links":["https://ko-fi.com/gorrie"],"categories":[],"sub_categories":[],"readme":"# Postcss-functions-lite\n\n[PostCSS](https://github.com/postcss/postcss) plugin for exposing JavaScript functions.  This is a lite [alternative](https://github.com/andyjansson/postcss-functions) which doesn't include globbing or have promises built in.\n\nInspired by [postcss functions by Andy Jansson](https://github.com/andyjansson/postcss-functions).\n\n## Key differences between lite and [functions](https://github.com/andyjansson/postcss-functions)\n\nLite is a bare minimal alternative of [postcss functions](https://github.com/andyjansson/postcss-functions)\n\n- [Globbing](#globbing) is not built in.\n- Promises are not built in.\n\n## Installation\n\n```js\nnpm install --save-dev postcss-functions-lite\n```\n\n### Requirements\n\n- Postcss 8\n\n## Usage\n\n```js\nconst fs = require('fs')\nconst postcss = require('postcss')\nconst postcssFunctions = require('postcss-functions-lite')\n\nconst options = {\n  // options\n}\n\nconst css = fs.readFileSync('input.css', 'utf8')\n\npostcss()\n  .use(postcssFunctions(options))\n  .process(css)\n  .then(result =\u003e {\n    const output = result.css\n  })\n```\n\nExample of a function call:\n\n```css\nbody {\n  prop: foobar()\n}\n```\n\n## Options\n\n### functions\n\nType: `Object`\n\nAn object containing functions. The function name will correspond with the object key.\n\n**Example:**\n\n```js\nconst color = require('css-color-converter')\nconst postcssFunctions = require('postcss-functions-lite')\n\nreturn postcssFunctions({\n  functions: {\n    darken: (value, frac) =\u003e  {\n      const darken = 1 - parseFloat(frac)\n      const rgba = color(value).toRgbaArray()\n      const r = rgba[0] * darken\n      const g = rgba[1] * darken\n      const b = rgba[2] * darken\n      return color([r,g,b]).toHexString()\n    }\n  }\n})\n```\n\n```css\n.foo {\n  /* make 10% darker */\n  color: darken(blue, 0.1)\n}\n```\n\n## Globbing\n\nAs mentioned above lite doesn't include globbing.  If you require globbing then it is recommended to switch to [functions](https://github.com/andyjansson/postcss-functions) or alternatively build a basic glob.\n\n**Example:**\n\n```js\nconst path require('path')\nconst glob = require('glob')\nconst postcssFunctions = require('postcss-functions-lite')\nlet globFunctions = {}\n\n// ...\nglob.sync('**/*.js').forEach(file =\u003e {\n  const name = path.basename(file, path.extname(file))\n  globFunctions[name] = require(path.basename(file, path.extname(file)))\n})\n// ...\n\nreturn postcssFunctions({\n  functions: {\n    doSomething: (value) =\u003e  {\n      // do something\n    },\n    ...globFunctions\n  }\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorriecoe%2Fpostcss-functions-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgorriecoe%2Fpostcss-functions-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorriecoe%2Fpostcss-functions-lite/lists"}