GithubHelp home page GithubHelp logo

voliware / node-build Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 64 KB

JS, CSS, and HTML minfier and injector for building webpages

License: MIT License

JavaScript 98.67% CSS 0.17% HTML 1.12% Rich Text Format 0.04%
build minify concat inject webbuild web-build css-minifier js-minifier html-inject

node-build's Introduction

node-build

JS and CSS minfier for @voliware/node-based projects. Uses clean-css and uglify-es.

Install

Install with node package manager

npm install @voliware/node-build

Include in a file

const NodeBuild = require('@voliware/node-build');

Usage

node-build automatically detects JS vs CSS.

const NodeBuild = require('@voliware/node-build');

new NodeBuild.Build({
   name: "Library",
   version: "1.2.3",
   input: ["./src/js/library.js", "./src/js/plugins.js"],
   output: "./dist/library.min.js"
}).run();

Mulitple Config Example

Minify a JS/CSS library, which has a base file and optional plugin files, to produce multiple builds.

const NodeBuild = require('@voliware/node-build');
const version = "1.0.3";

// library base
const jsBaseInput = './src/js/library.js';
const jsBaseOutput = './dist/library.min.js';
const jsBaseConfig = {
    name: "Library JS [base]",
    version: version,
    input: jsBaseInput,
    output: jsBaseOutput
};

// library bundle
const jsBundleInput = [
    './src/js/library.js',
    './src/js/plugin1.js',
    './src/js/plugin2.js'
];
const jsBundleOutput = './dist/library-bundle.min.js';
const jsBundleConfig = {
    name: "Library JS [bundle]",
    version: version,
    input: jsBundleInput,
    output: jsBundleOutput
};

// css
const cssInput = './src/css/library.css';
const cssOutput = './dist/library.min.css';
const cssConfig = {
    name: "Library CSS",
    version: version,
    input: cssInput,
    output: cssOutput
};

// build
let configs = [jsBaseConfig, jsBundleConfig, cssConfig];
new NodeBuild.Build(configs).run();

node-build's People

Contributors

tones31 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.