1.1.0 • Published 3 years ago

cssmerger v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

CSSmerger

Introduction

CSSmerger is a tool for bundling all of your css files into a single file in order to easily modularize your CSS while still only linking a single file in your HTML.

Installation

npm install cssmerger

Usage

Run the CSSmerger function early in your code, in your 'index.js' file or other entry point. It will merge the selected files into the selected output file when your web server is started.

/**
 * @param {Array<String>} files - The files and directories to be merged
 * @param {String} output - The file to be output
 * @param {Object} options - Any options to set
 */
const cssmerger = require("cssmerger");

let options = {
    recursive: true,
    minimize: false
};

let files = [
    "./path/to/file.css",
    "./path/to/entire/directory"
];

cssmerger(files, "./path/to/output.css", options);

Options

OptionPropertiesDescription
recursivedefault=trueWhen true, will recursively search all sub-directories for all CSS files. When false, will use only the CSS files that are a direct child of any directories
minimizedefaut=falseWhen true will shrink the file size as much as possible. False will leave the file easier to read and work with.

Notes

  1. You may pass in either CSS files directly or a directory to read all of the files within it.

  2. Will only read CSS files. Other files will be ignored.

  3. Do not rely on the "cascading" aspect of CSS as the order of the CSS may be unexpected. It is best to rely on specificity.

  4. You can call the function as many times as you want to create different CSS files for use with your HTML.

1.0.2

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago