Code Monkey home page Code Monkey logo

css-merger's Introduction

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

Option Properties Description
recursive default=true When 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
minimize defaut=false When 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.

css-merger's People

Contributors

morganlee909 avatar

Watchers

James Cloos 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.