6.1.0 • Published 1 month ago

rucksack v6.1.0

Weekly downloads
23
License
MIT
Repository
github
Last release
1 month ago

rucksack

rucksack

Version Downloads

JavaScript and CSS bundler.

:cloud: Installation

# Using npm
npm install --save rucksack

# Using yarn
yarn add rucksack

:clipboard: Example

const Rucksack = require("rucksack")

// Create a new bundler
let bundler = new Rucksack({
    aliases: {
        "foo": `${__dirname}/data/bar/foo.js`
    }
})

// Add remote url as resource
bundler.add("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js")
bundler.add(`${__dirname}/data/main.js`)
bundler.add(`${__dirname}/data/another-main.js`)
bundler.add(`${__dirname}/data/bar.css`)
bundler.add(`${__dirname}/data/main.css`)
//bundler.add({
//    type: "css",
//    url: "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css",
//    inline: true
//})

bundler.bundleCSS(`${__dirname}/test.css`)
// => info  [Tuesday, November 28, 2017 06:53:48 AM] Bundling  the styles.
// => warn  [Tuesday, November 28, 2017 06:53:48 AM] Skipping remote @import of "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css" as resource is not allowed.
// => @import url(https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css);strong{color:#000}strong{color:#ff0}body{background:#fff;-webkit-transform:translate(10px);transform:translate(10px)}

bundler.bundleJS(`${__dirname}/test.js`)
// => info  [Tuesday, November 28, 2017 06:53:48 AM] Bundling  the scripts.
// => (function e(t,n,r){...})

:question: Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
  2. For bug reports and feature requests, open issues. :bug:

:memo: Documentation

constructor

Ruckasck Creates a new instance of Ruckasck.

Params

  • Object opts: The Rucksack options.

Return

  • Object The Rucksack instance.

_watchCSS(resPath)

Watch the CSS paths.

Params

  • String resPath: The CSS resource path.

addCSS(resPath, inline)

Adds a new CSS path.

Params

  • String resPath: The CSS resource path to add.
  • Boolean inline: Whether to add the CSS content inline or not.

bundleJS(output, cb)

Bundles the JS files.

Params

  • String output: The output of the JS script.
  • Function cb: The callback function.

bundleCSS(output, cb)

Bundles the CSS files.

Params

  • String output: The output of the CSS script.
  • Function cb: The callback function.

Return

  • String The URL of the script.

:yum: How to contribute

Have an idea? Found a bug? See how to contribute.

:dizzy: Where is this library used?

If you are using this library in one of your projects, add it in this list. :sparkles:

  • bloggify
  • bloggify-cli
  • bloggify-prebuilt

:scroll: License

MIT © Bloggify

6.1.0

1 month ago

5.0.3

4 months ago

6.0.1

4 months ago

6.0.0

4 months ago

5.0.2

1 year ago

5.0.1

1 year ago

5.0.0

1 year ago

4.5.0

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.3.0

4 years ago

4.2.3

4 years ago

4.2.2

4 years ago

4.2.1

4 years ago

4.2.0

4 years ago

4.1.0

5 years ago

4.0.4

6 years ago

4.0.3

6 years ago

4.0.2

6 years ago

4.0.0

6 years ago

2.3.7

6 years ago

2.3.6

6 years ago

2.3.5

7 years ago

2.3.4

7 years ago

2.3.3

7 years ago

2.3.2

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.0

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago