2.2.5 • Published 2 months ago

@taufik-nurrohman/factory v2.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

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. Karena cara pakainya npm run pack. Xixixi lucu yah pack 😁

Usage

mkdir my-project
mkdir my-project/src
mkdir my-project/dist

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

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

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

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

Generate the production ready files this way:

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:

/// FETCH('../node_modules/bootstrap/dist/css/bootstrap.css');
/// FETCH('../node_modules/bootstrap/dist/js/bootstrap.js');

External URL will be downloaded, and its content will replace the “fetch” block:

/// FETCH('https://example.com/assets/index.css');
/// FETCH('https://example.com/assets/index.js');

Options

KeyDescription
--cleanClean-up the old compiled files before re-compile (default to true).
--fromFolder path to store the files to be compiled (default to "src").
--js-bottomInsert string at the bottom of the file (default to "").
--js-exportsWhat export mode to use? (default to "auto").
--js-externalJavaScript external module names (default to "").
--js-formatJavaScript module format (default to "iife").
--js-globalsJavaScript global variables (default to ""). Example: --js-globals="jquery:jQuery,react:React,vue:Vue".
--js-nameJavaScript module name (default to "").
--js-topInsert string at the top of the file (default to "").
--mjsInclude MJS files to the output.
--pugInclude PUG files to the output.
--scssInclude SCSS files to the output.
--silentDisable logging (default to false).
--toFolder path to store the compiled files (default to "dist").
--versionShow version information.
2.2.5

2 months ago

2.2.4

9 months ago

2.2.1

9 months ago

2.2.0

9 months ago

2.2.3

9 months ago

2.2.2

9 months ago

2.1.0

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.3

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.6

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.14

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.9

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.1.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago