Giter VIP home page Giter VIP logo

factory's Introduction

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

Invalid import statements on *.mjs and *.scss files with valid file path will be imported inline:

@import '../node_modules/bootstrap/dist/css/bootstrap.css';
import '../node_modules/bootstrap/dist/js/bootstrap.js';

External URL will be downloaded, and its contents will replace the import block:

@import 'https://example.com/assets/index.css';
import '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 to use? (default to "auto").
--js-external JavaScript external module names (default to "").
--js-format JavaScript module format (default to "iife").
--js-globals JavaScript global variables (default to ""). Example: --js-globals="jquery:jQuery,react:React,vue:Vue".
--js-name JavaScript module name (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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.