# @taufik-nurrohman/factory

> Simple Node.js script to generate CSS, HTML, and JavaScript files from ECMAScript, Pug, and SCSS files.

Latest version **2.3.1** (published 2025-07-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @taufik-nurrohman/factory
pnpm add @taufik-nurrohman/factory
yarn add @taufik-nurrohman/factory
bun add @taufik-nurrohman/factory
```

Provides the command `pack`.

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.1 |
| Published | 2025-07-10 |
| First published | 2021-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 17 |
| Unpacked size | 24.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Taufik Nurrohman |
| Maintainers | taufik-nurrohman |
| Keywords | cli, css, html, js, mjs, pug, scss |

## Links

- npm: https://www.npmjs.com/package/@taufik-nurrohman/factory
- Repository: https://github.com/taufik-nurrohman/factory
- Homepage: https://taufik-nurrohman.js.org
- Issues: https://github.com/taufik-nurrohman/factory/issues
- npm.io page: https://npm.io/package/@taufik-nurrohman/factory

## Dependencies (17)

- [pug](https://npm.io/package/pug.md) ^3.0.3
- [sass](https://npm.io/package/sass.md) ^1.89.2
- [yargs](https://npm.io/package/yargs.md) ^18.0.0
- [rollup](https://npm.io/package/rollup.md) ^4.44.2
- [terser](https://npm.io/package/terser.md) ^5.43.1
- [clean-css](https://npm.io/package/clean-css.md) ^5.3.3
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.28.0
- [js-beautify](https://npm.io/package/js-beautify.md) ^1.15.4
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.28.0
- [@rollup/plugin-babel](https://npm.io/package/@rollup/plugin-babel.md) ^6.0.4
- [@taufik-nurrohman/file](https://npm.io/package/@taufik-nurrohman/file.md) *
- [@rollup/plugin-commonjs](https://npm.io/package/@rollup/plugin-commonjs.md) ^28.0.6
- [@taufik-nurrohman/folder](https://npm.io/package/@taufik-nurrohman/folder.md) *
- [@rollup/plugin-node-resolve](https://npm.io/package/@rollup/plugin-node-resolve.md) ^16.0.1
- [@babel/plugin-transform-private-methods](https://npm.io/package/@babel/plugin-transform-private-methods.md) ^7.27.1
- [@babel/plugin-transform-class-properties](https://npm.io/package/@babel/plugin-transform-class-properties.md) ^7.27.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.3.1 (latest) — 2025-07-10
- 2.3.0 — 2025-06-30
- 2.2.5 — 2025-05-18
- 2.2.4 — 2024-10-25
- 2.2.3 — 2024-10-24
- 2.2.2 — 2024-10-23
- 2.2.1 — 2024-10-23
- 2.2.0 — 2024-10-23
- 2.1.0 — 2023-12-22
- 2.0.8 — 2023-06-12
- 2.0.7 — 2023-04-07
- 2.0.6 — 2022-09-12
- 2.0.5 — 2022-09-09
- 2.0.4 — 2022-09-08
- 2.0.3 — 2022-09-07
- … 43 more at https://npm.io/package/@taufik-nurrohman/factory/versions

## README

Factory
=======

Simple Node.js script to generate CSS, HTML, and JavaScript files from ECMAScript, Pug, and SCSS files.

_Paket, paket Node.js apa yang digemari para suami? Namanya [@taufik-nurrohman/factory](https://www.npmjs.com/package/@taufik-nurrohman/factory). Karena cara pakainya `npm run pack`. Xixixi lucu yah pack_ 😁

Usage
-----

~~~ sh
mkdir my-project
mkdir my-project/src
mkdir my-project/dist
~~~

Paste your `*.scss`, `*.mjs`, and `*.pug` files to `.\my-project\src` folder.

~~~ sh
cd my-project
npm install @taufik-nurrohman/factory --save-dev
~~~

Create a `scripts` field that runs the `pack` command in `.\my-project\package.json`

~~~ json
{
  "scripts": {
    "pack": "pack --from=src --to=dist"
  }
}
~~~

Generate the production ready files this way:

~~~ sh
npm run pack
~~~

File extension from the source folder will be removed. Make sure to name your files with two file extension like so:

 - `index.css.scss`
 - `index.html.pug`
 - `index.js.mjs`
 - `index.php.pug`
 - `LICENSE.txt`
 - `LICENSE.txt.txt`

So that in the distributable folder, your files will be renamed to:

 - `index.css`
 - `index.html`
 - `index.js`
 - `index.php`
 - `LICENSE`
 - `LICENSE.txt`

> [!TIP]
>
> Use “fetch” syntax in `*.mjs` and `*.scss` files with a valid file path to load it inline:
>
> ~~~ scss
> /// FETCH('../node_modules/bootstrap/dist/css/bootstrap.css');
> ~~~
>
> ~~~ mjs
> /// FETCH('../node_modules/bootstrap/dist/js/bootstrap.js');
> ~~~
>
> External URL will be downloaded, and its content will replace the “fetch” block:
>
> ~~~ scss
> /// FETCH('https://example.com/assets/index.css');
> ~~~
>
> ~~~ mjs
> /// FETCH('https://example.com/assets/index.js');
> ~~~

Options
-------

Key | Description
--- | -----------
`--clean` | Clean-up the old compiled files before re-compile (default to `true`).
`--from` | Folder path to store the files to be compiled (default to `"src"`).
`--js-bottom` | Insert string at the bottom of the file (default to `""`).
`--js-exports` | What [export mode](https://rollupjs.org/guide/en/#outputexports) to use? (default to `"auto"`).
`--js-external` | JavaScript [external module names](https://rollupjs.org/guide/en/#quick-start) (default to `""`).
`--js-format` | JavaScript [module format](https://rollupjs.org/guide/en/#quick-start) (default to `"iife"`).
`--js-globals` | JavaScript global variables (default to `""`). Example: `--js-globals="jquery:jQuery,react:React,vue:Vue"`.
`--js-name` | JavaScript [module name](https://rollupjs.org/guide/en/#quick-start) (default to `""`).
`--js-top` | Insert string at the top of the file (default to `""`).
`--mjs` | Include MJS files to the output.
`--pug` | Include PUG files to the output.
`--scss` | Include SCSS files to the output.
`--silent` | Disable logging (default to `false`).
`--to` | Folder path to store the compiled files (default to `"dist"`).
`--version` | Show version information.

---
_Source: https://npm.io/package/@taufik-nurrohman/factory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
