npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rollup-plugin-sass-bundle

v1.1.2

Published

A simple rollup plugin for transpile sass and bundle and output a single file

Downloads

299

Readme

rollup-plugin-sass-bundle

issues npm mit

Install

npm install -D rollup-plugin-sass-bundle

Description

A simple rollup plugin that only delegates to the sass runtime used to transpile sass files to css and bundles it all in a single file, optionally bundling can be turned off, in that case the plugin just transforms the files and rollup passes it on to the other plugins.

Usage

// rollup.config.js
import sass from 'rollup-plugin-sass-bundle';

export default {
  input: 'index.js',
  output: {
    file: 'bundle.js',
    format: 'esm',
  },
  plugins: [
    sass({
      bundleOptions: {
        enabled: true,
        name: 'bundle.css'
      }
    })
  ]
}

Config

include and exclude

Type: String | RegExp | Array[...String|RegExp]

Default:

  • include: ['**/*.scss', '**/*.sass']
  • exclude: undefined

A valid picomatch pattern, or array of patterns. If options.include is omitted or has zero length, filter will return true by default. Otherwise, an ID must match one or more of the picomatch patterns, and must not match any of the options.exclude patterns.

Note that picomatch patterns are very similar to minimatch patterns, and in most use cases, they are interchangeable. If you have more specific pattern matching needs, you can view this comparison table to learn more about where the libraries differ.

loadPaths

Type: string[] | undefined

Additional loaded paths passed to the sass compiler

By default only the current directory of the file transformed by rollup and the root directory is passed

runtime

Type: SassCompiler

Default: Would look for and try to import sass

Provide a custom runtime to use instead of the default one.

sourceMap

Type: boolean | undefined

Default: false

Generate source map

sassOptions

Type: SassOptions

Pass or override any sass options, to configure the compilation process.

Importers can be provided here for example resolving node_modules imports using ~ syntax, see nodepackageimporter Please do not override loadPaths and use the option provided by the plugin, because that would remove the current directory of the processed file and the root directory already provided.

bundleOptions

Type: Object

enabled

Type: boolean | undefined

Default: true

When this option is disabled, the plugin would only compile the sass files and you would be expected to bundle them yourself or pass it to a different plugin.

name and fileName

Type: string | undefined

Default:

  • name: undefined
  • filename: undefined

The name and fileName options would be passed to the rollup emitFile hook.

When emitting chunks or assets, either a name or a fileName can be supplied. If a fileName is provided, it will be used unmodified as the name of the generated file, throwing an error if this causes a conflict. Otherwise, if a name is supplied, this will be used as substitution for [name] in the corresponding output.chunkFileNames or output.assetFileNames pattern, possibly adding a unique number to the end of the file name to avoid conflicts. If neither a name nor fileName is supplied, a default name will be used. Prebuilt chunks must always have a fileName.

include and exclude

Type: String | RegExp | Array[...String|RegExp]

Default:

  • include: ['**/*.scss', '**/*.sass', '**/*.css']
  • exclude: undefined

Same as the base plugin options but these options apply only when bunding, by default this option also includes

A valid picomatch pattern, or array of patterns. If options.include is omitted or has zero length, filter will return true by default. Otherwise, an ID must match one or more of the picomatch patterns, and must not match any of the options.exclude patterns.

Note that picomatch patterns are very similar to minimatch patterns, and in most use cases, they are interchangeable. If you have more specific pattern matching needs, you can view this comparison table to learn more about where the libraries differ.

License

MIT