3.1.2 • Published 4 years ago

scss-bundle v3.1.2

Weekly downloads
15,914
License
MIT
Repository
github
Last release
4 years ago

scss-bundle

Bundles all SCSS imports into a single file recursively.

Build Status NPM version dependencies Status devDependencies Status

Who uses scss-bundle

A few of the projects who use the package:

Get started

If you want to use scss-bundle globally

$ npm install scss-bundle -g

CLI Usage

$ scss-bundle -h

Examples

Without config file:

If you want to use scss-bundle without configuration file, entry and dest arguments are required.

$ scss-bundle -e ./src/main.scss -d bundled.scss

Or specifying output verbosity level.

$ scss-bundle -e ./src/main.scss -d bundled.scss --verbosity Errors

With config file:

$ scss-bundle -c scss-bundle.config.json

Config example

{
    "entry": "./src/main.scss",
    "dest": "bundled.scss"
}
ArgumentTypeDescriptionValuesDefault
entry *stringMain entry file where to start bundling.
dest *stringDestination file when bundling is done.
verbositystring choicesDestination file when bundling is done.None, Errors, VerboseVerbose
includePathsarrayInclude paths for resolving imports
projectstringProject location, where node_modules are located.

* - Required

Output verbosity

CLI option verbosity is used to control how much output you get. By default, you will get Verbose level of verbosity with the most output.

ValueDescription
NoneProduces no output, only process success/error return code.
ErrorsOutputs all errors and skips any additional information.
VerboseOutputs the most information. This is the default value for verbosity level.

Non-CLI usage

Simple example

import { Bundler } from "scss-bundle";
import * as path from "path";

const fullPath = path.resolve("./examples/simple/main.scss");

Bundler.Bundle(fullPath)
    .then(result => {
        console.log("Bundled SCSS content: ", result.content);
    })
    .catch(error => {
        console.error(error);
    });

API

Bundler

import { Bundler } from "scss-bundle";

Constructor

constructor(fileRegistry: FileRegistry = {}, projectDirectory?: string) {}
Arguments
  • fileRegistry?: Registry - Dictionary of files contents by full path
  • projectDirectory?: string - Absolute project location, where node_modules are located. Used for resolving tilde imports

Methods

Bundle

public static async Bundle(file: string, fileRegistry: Registry = {}): Promise<BundleResult>
Arguments
  • file: string - Main file full path
  • fileRegistry: Registry - Dictionary of files contents by full path
Returns

Promise<BundleResult>

BundleAll

public static async BundleAll(files: string[], fileRegistry: Registry = {}): Promise<BundleResult[]>
Arguments
  • files: string[] - Array of full path files
  • fileRegistry:Registry - Dictionary of files contents by full path
Returns

Promise<BundleResult[]>

Contracts

BundleResult

import { BundleResult } from "scss-bundle";
interface BundleResult {
    imports?: BundleResult[];
    tilde?: boolean;
    filePath: string;
    content?: string;
    found: boolean;
}
Properties
  • imports: BundleResult[] - File imports array
  • tidle?: boolean - Used tilde import
  • filePath: string - Full file path
  • content: string - File content
  • found: boolean - Is file found

Registry

import { Registry } from "scss-bundle";
interface Registry {
    [id: string]: string | undefined;
}
Key

id: string - File full path as dictionary id

Value

string | undefined - File content

License

Released under the MIT license.

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.2

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.5.1

5 years ago

2.5.0

5 years ago

2.5.0-beta

5 years ago

2.4.0

6 years ago

2.3.3

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0-beta

6 years ago

2.2.0

6 years ago

2.2.0-beta.2

6 years ago

2.2.0-beta

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

7 years ago

2.0.1-beta.7

7 years ago

2.0.1-beta.6

7 years ago

2.0.1-beta.5

7 years ago

2.0.1-beta.4

7 years ago

2.0.1-beta.3

7 years ago

2.0.1-beta

7 years ago

2.0.0-beta

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

1.0.0-beta.3

7 years ago

1.0.0-beta.2

7 years ago

1.0.0-beta

7 years ago

0.2.3-beta

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago