{"id":18254273,"url":"https://github.com/brikcss/stakcss","last_synced_at":"2025-04-08T21:47:28.612Z","repository":{"id":143745467,"uuid":"127042355","full_name":"brikcss/stakcss","owner":"brikcss","description":"Stakcss is a flexible file/content bundler. It is similar to webpack, rollup, or postcss, except Stakcss is not limited a specific type of file or content. Stakcss can do almost anything your heart desires.","archived":false,"fork":false,"pushed_at":"2020-06-02T07:44:43.000Z","size":2981,"stargazers_count":1,"open_issues_count":9,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-15T23:06:13.381Z","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/brikcss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-03-27T20:28:58.000Z","updated_at":"2020-06-03T23:48:30.000Z","dependencies_parsed_at":"2023-05-18T05:31:45.296Z","dependency_job_id":null,"html_url":"https://github.com/brikcss/stakcss","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/brikcss%2Fstakcss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brikcss%2Fstakcss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brikcss%2Fstakcss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brikcss%2Fstakcss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brikcss","download_url":"https://codeload.github.com/brikcss/stakcss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247934808,"owners_count":21020724,"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-05T10:11:21.665Z","updated_at":"2025-04-08T21:47:28.592Z","avatar_url":"https://github.com/brikcss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stakcss\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/brikcss/stakcss.svg)](https://greenkeeper.io/)\n\n\u003e Stakcss takes a \"stak\" of files or input, runs it all through a \"stak\" of configured bundlers (not included), and outputs compiled result, optionally saving to disk. Stakcss works similarly to tools like webpack, rollup, and postcss. The primary difference is that Stakcss can bundle or compile any type of file or content, where others only bundle one specific. Alone Stakcss doesn't do much, but in concert with bundlers it can do almost anything your heart desires.\n\n\u003c!-- Shields. --\u003e\n\u003cp\u003e\n\t\u003c!-- NPM version. --\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/@brikcss/stakcss\"\u003e\n\t\t\u003cimg alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@brikcss/stakcss.svg?style=flat-square\"\u003e\n\t\u003c/a\u003e\n\t\u003c!-- NPM downloads/month. --\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/@brikcss/stakcss\"\u003e\n\t\t\u003cimg alt=\"NPM downloads per month\" src=\"https://img.shields.io/npm/dm/@brikcss/stakcss.svg?style=flat-square\"\u003e\n\t\u003c/a\u003e\n\t\u003c!-- Travis branch. --\u003e\n\t\u003ca href=\"https://github.com/brikcss/stakcss/tree/master\"\u003e\n\t\t\u003cimg alt=\"Travis branch\" src=\"https://img.shields.io/travis/rust-lang/rust/master.svg?style=flat-square\u0026label=master\"\u003e\n\t\u003c/a\u003e\n\t\u003c!-- Codacy grade. --\u003e\n\t\u003ca href=\"https://www.codacy.com/app/thezimmee/stakcss\"\u003e\n\t\t\u003cimg alt=\"NPM version\" src=\"https://img.shields.io/codacy/grade/28adee991e004621b2a9bece53370661/master.svg?style=flat-square\"\u003e\n\t\u003c/a\u003e\n\t\u003c!-- Codacy coverage. --\u003e\n\t\u003ca class=\"badge-align\" href=\"https://www.codacy.com/app/thezimmee/stakcss\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/codacy/coverage/28adee991e004621b2a9bece53370661/master.svg?style=flat-square\"/\u003e\n\t\u003c/a\u003e\n\t\u003c!-- Coveralls coverage. --\u003e\n\t\u003ca href='https://coveralls.io/github/brikcss/stakcss?branch=master'\u003e\n\t\t\u003cimg src='https://img.shields.io/coveralls/github/brikcss/stakcss/master.svg?style=flat-square' alt='Coverage Status' /\u003e\n\t\u003c/a\u003e\n\t\u003c!-- Commitizen friendly. --\u003e\n\t\u003ca href=\"http://commitizen.github.io/cz-cli/\"\u003e\n\t\t\u003cimg alt=\"Commitizen friendly\" src=\"https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square\"\u003e\n\t\u003c/a\u003e\n\t\u003c!-- Semantic release. --\u003e\n\t\u003ca href=\"https://github.com/semantic-release/semantic-release\"\u003e\n\t\t\u003cimg alt=\"semantic release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square\"\u003e\n\t\u003c/a\u003e\n\t\u003c!-- Prettier code style. --\u003e\n\t\u003ca href=\"https://prettier.io/\"\u003e\n\t\t\u003cimg alt=\"code style: prettier\" src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square\"\u003e\n\t\u003c/a\u003e\n\t\u003c!-- MIT License. --\u003e\n\t\u003c!-- \u003ca href=\"https://choosealicense.com/licenses/mit/\"\u003e\n\t\t\u003cimg alt=\"License\" src=\"https://img.shields.io/npm/l/express.svg?style=flat-square\"\u003e\n\t\u003c/a\u003e --\u003e\n\u003c/p\u003e\n\n## Environment support\n\n| Node | ES Module | Browser | UMD | CLI |\n| :--: | :-------: | :-----: | :-: | :-: |\n|  ✓   |     x     |    x    |  x  |  ✓  |\n\n## Install\n\n```sh\nnpm install @brikcss/stakcss --save-dev\n```\n\n## Terminology\n\nJust to be clear:\n\n- _Stakcss_: This bundler tool.\n- _stak (noun)_: A \"stack\" of source files or content chunks to be bundled, or processed, in a desired manner.\n- _bundler_: A function which processes a \"stak\" of files or content chunks in a specific way. Each stak can be run through one or more bundlers to achieve a desired result.\n- _bundle (noun)_: The output returned by the bundler(s).\n- _bundle / stak (verb)_: The process of running one or more _staks_ through a series of one or more _bundlers_ to be output to a single bundle.\n\n## Usage\n\nStakcss provides an API to run files or content through a series of bundlers. See below for [creating a bundler](#creating-a-bundler). You may bundle a stak in Node or the command line:\n\n- Node:\n  `js const stak = require('@brikcss/stakcss'); stak(options);`\n- CLI:\n  `sh stak \u003csource files\u003e [options] # or: node node_modules/.bin/stak \u003csource files\u003e [options]`\n\n### Options\n\n- **`source`** _{String | Array | Glob}_ (_required_) Source file paths.\n\n- **`content`** _{String}_ Source content.\n\n- **`output`** _{String}_ (_required_) Output path. _Note: If this is directory (either '/' as last character or an actual directory), OR if it contains `[name]` or `[ext]`, then `stakEachFile` is automatically set to true and each file is treated as its own stak. `[name]` and `[ext]` provide the template for the output path. See `stakEachFile` for more details._\n\n- **`bundlers`** _{Array | String}_ (_required_) List of bundlers to run the stak through. A _{String}_ should be a comma-separated list. Each bundler can be any of the following:\n\n      \t- _{String}_ path to node module, which is `require`d like any other node module.\n      \t- _{Function}_ (via Node or config file) which is run on each stak.\n      \t- _{Object}_ (via Node or config file) where:\n      \t\t- **`bundler.run`** is the function to be run on each stak.\n      \t\t- **`bundler.*`** can be provided by user for bundler configuration. The `bundler` object is passed to each stak (see [creating a bundler](#creating-a-bundler)).\n\n      \t_Note: Stakcss Bundler module names should be prefixed with `stakcss-bundler-`. For convenience, when referencing bundlers by name in the `bundlers` setting, you may optionally remove `stakcss-bundler-` from the name and Stakcss will still pick the module up. For example: `bundlers: ['@brikcss/stakcss-bundler-copy']` and `bundlers: ['@brikcss/copy']` will both pick run the `@brikcss/stakcss-bundler-copy` bundler._\n\n- **`root`** _{String}_ (`.`) Source paths will be output relative to this directory.\n\n- **`cwd`** _{String}_ (`process.cwd()`) Current working directory. Affects bundler path resolution and default search path for the config file.\n\n- **`rename`** _{Function}_ (via Node or config file) Callback to allow user to rename output files. Useful when `output` is a directory.\n\n- **`config`** _{String}_ Path to config file. You can also use the shorthand syntax to set the config path and `profiles` to run at the same time. For example:\n\n      \t```sh\n      \tstak --config=\u003cpath\u003e:\u003cprofiles\u003e\n      \t```\n\n- **`profiles`** _{String | Array}_ The config file can be set up to run multiple \"profiles\". In this case, each property name in the config file is a config profile. This option is passed to tell Stakcss which profile(s) to run. An array or comma-separated list will run multiple profiles. Or setting this property to `all` will run all profiles.\n\n      \t```sh\n      \tstak --config=\u003cpath\u003e --profiles=\u003cprofiles\u003e\n      \t```\n\n      \t```sh\n      \t# Run all profiles in the config file.\n      \tstak --config=\u003cpath\u003e --profiles=all\n      \t```\n\n      \tYou may also use the shorthand version with the `config` option as follows:\n\n      \t```sh\n      \tstak --config=\u003cpath\u003e:\u003cprofiles\u003e\n      \t```\n\n- **`id`** _{String}_ ID or name of stak, used in log notifications. Defaults to profile property name, if exists, or the profile index.\n\n- **`stakEachFile`** _{Boolean}_ (`false`) Whether to treat each file as its own stak. This option is automatically set to `true` if:\n\n      \t- `output` ends with `/`.\n      \t- `output` is a directory.\n      \t- `output` contains `[name]`.\n\n      \t_`output` path template:_\n      \tWhen `stakEachFile` is true and `output` exists, Stakcss replaces `[name]` and `[ext]` with source file path's `name` and `ext`. If `[name]` is not found in `output`, `output` is set to `path.join(output, '[name].[ext]')`.\n\n- **`watch`** _{Boolean}_ Watch source file paths and \"restak\" when they change.\n\n- **`watchPaths`** _{Glob}_ Additional path(s) to watch when running the watcher. These paths do not get bundled, but when they change they will trigger a rebundle. It may be useful to include files in the watcher that the source files depend on.\n\n_Note: Some options, as noted above, are not available via the CLI unless you use a config file._\n\n## Creating a bundler\n\nCreating a bundler is easy. To illustrate, here is a simple bundler:\n\n```js\nconst fs = require('fs-extra');\n\nmodule.exports = (config = {}, bundler = {}) =\u003e {\n  if (!config.content) {\n    config.source.forEach((filepath) =\u003e (config.content += fs.readFileSync(filepath, 'utf8')));\n  }\n  return config;\n};\n```\n\nThis bundler copies file content from `config.source` to `config.content`, which Stakcss will later output to `config.output`. Simple enough, but it paints the picture. Note the following:\n\n- `config` is the user's config object and contains the list of accepted options.\n- `bundler` is optionally provided by the user and can be anything. It is intended to pass settings to each individual bundler.\n\n### Rules for creating a bundler\n\n1.  Stakcss global config is provided via `config`. Bundler specific config is provided via `bundler`. Except for `config.content` and `config.sourceMap`, these should generally not be modified.\n2.  **Important**: If `config.content` does not exist:\n    1.  Use `config.source` to get source content.\n    2.  Modify it to your heart's content.\n    3.  Save it to `config.content`.\n3.  You must return the `config` object with the newly bundled / transformed `config.content`.\n4.  You can optionally return a `Promise`. Stakcss will keep bundler results in order.\n5.  `config.sourceMap` is for use with sourcemaps.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrikcss%2Fstakcss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrikcss%2Fstakcss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrikcss%2Fstakcss/lists"}