# gulp-css-globbing

> A Gulp plugin for globbing CSS @import statements

Latest version **0.2.2** (published 2017-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-css-globbing
pnpm add gulp-css-globbing
yarn add gulp-css-globbing
bun add gulp-css-globbing
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2017-06-28 |
| First published | 2014-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5.12.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Johan Sahlén |
| Maintainers | arzafran, jsahlen |
| Keywords | gulpplugin, css, glob |

## Links

- npm: https://www.npmjs.com/package/gulp-css-globbing
- Repository: https://github.com/arzafran/gulp-css-globbing
- Homepage: https://github.com/arzafran/gulp-css-globbing#readme
- Issues: https://github.com/arzafran/gulp-css-globbing/issues
- npm.io page: https://npm.io/package/gulp-css-globbing

## Dependencies (3)

- [glob](https://npm.io/package/glob.md) ^7.1.2
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.8
- [vinyl-map](https://npm.io/package/vinyl-map.md) ^1.0.2

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2017-06-28
- 0.2.1 — 2017-05-24
- 0.2.0 — 2017-05-24
- 0.1.9 — 2016-10-24
- 0.1.8 — 2015-05-18
- 0.1.7 — 2015-03-02
- 0.1.6 — 2015-02-26
- 0.1.5 — 2015-01-23
- 0.1.4 — 2014-09-23
- 0.1.3 — 2014-09-18
- 0.1.2 — 2014-07-03
- 0.1.1 — 2014-07-03
- 0.1.0 — 2014-07-03

## README

# gulp-css-globbing [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]
> A Gulp plugin for globbing CSS `@import` statements

Expands CSS `@import` statements containing globs with the full paths. Useful with pre-processors like Sass.

Heavily inspired by [`sass-globbing`](https://github.com/chriseppstein/sass-globbing)

**NEW MANTAINER NOTICE:** This library proved useful for me and that's why I've started to actively mantain it.

## Install

Install `gulp-css-globbing` as a development dependency using npm:

```shell
npm install --save-dev gulp-css-globbing
```

## Usage

```javascript
var cssGlobbing = require('gulp-css-globbing');

gulp.task('css', function(){
  gulp.src(['src/styles.css'])
    .pipe(cssGlobbing())
    .pipe(gulp.dest('build/styles.css'));
});
```

Given a CSS file that looks like this:

```css
@import url('components/*.css');

body {
  background: white;
}
```

The plugin would produce the following:

```css
@import url('components/flex-embed.css');
@import url('components/media.css');

body {
  background: white;
}
```

Globbing is relative to the source file's path.


## Options

`gulp-css-globbing` can be called with an options object:

```javascript
gulp.task('css', function(){
  gulp.src(['src/styles.css'])
    .pipe(cssGlobbing({
      extensions: ['.css', '.scss'],
      ignoreFolders: ['../styles'],
      autoReplaceBlock: {
        onOff: false,
        globBlockBegin: 'cssGlobbingBegin',
        globBlockEnd: 'cssGlobbingEnd',
        globBlockContents: '../**/*.scss'
      },
      scssImportPath: {
        leading_underscore: false,
        filename_extension: false
      }
    }))
    .pipe(gulp.dest('build/styles.css'));
});
```

### extensions
Type: `String` or `Array`

The file extensions to treat as valid imported files. If files are found that match the glob, but its extensions don't match this option, they will not be added to the resulting file.

Default: `['.css']`

### ignoreFolders
Type: `String` or `Array`

Folders gulp-css-globbing should ignore. Each folder should be relative to the source file.

Default: `['']`

### autoReplaceBlock
Type: `String` or `Object`

Search for a block of text which is replaced with the path to the files we want to glob. Path can be re-replaced each time we call gulp-css-globbing.

Default: 
```
{
  onOff: false,
  globBlockBegin: 'cssGlobbingBegin',
  globBlockEnd: 'cssGlobbingEnd',
  globBlockContents: '../**/*.scss'
}
```

With the above settings, inside of your main .scss file you would only need to have this:
```
// cssGlobbingBegin
// this line can be blank
// cssGlobbingEnd
```

### scssImportPath
Type: `Object`

Allows for [default scss rules for writing scss import paths](https://github.com/causes/scss-lint/blob/master/lib/scss_lint/linter/README.md#importpath).

Default:
```
{
  leading_underscore: true, // underscores will NOT be removed
  filename_extension: true // extensions will NOT be removed
}
```

#### Leading Underscore

If `leading_underscore` is set to `false`, then the *first* leading underscore of a file name will be removed. Example: `.../main/_main.scss` becomes `@import '../main/main.scss';`

#### Filename Extension

If `filename_extension` is set to `false`, then the the extension of a file name will be removed. Example: `.../main/_main.scss` becomes `@import '../main/_main';`



[travis-url]: https://travis-ci.org/arzafran/gulp-css-globbing
[travis-image]: https://travis-ci.org/arzafran/gulp-css-globbing.svg?branch=master
[depstat-url]: https://david-dm.org/arzafran/gulp-css-globbing
[depstat-image]: https://david-dm.org/arzafran/gulp-css-globbing.svg

---
_Source: https://npm.io/package/gulp-css-globbing · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
