import-glob-loader
Globbing preloader for Webpack
Last updated 5 years ago by aintaer .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install import-glob-loader 
SYNC missed versions from official npm registry.

import-glob-loader

Globbing preloader for Webpack

Expands globbing patterns for import statements. Currently only does vertical expansion, e.g.

@import "foo/**/*";

Expands into

@import "foo/1.scss";
@import "foo/bar/2.scss";
@import "foo/bar/3.scss";

Install

npm install import-glob-loader --save-dev

Usage

You can use it one of two ways, the recommended way is to use it as a preloader for files you know has import statements. This usually applies to ES6 module import statements, CSS @import at-rules, and Sass @import statements.

{
  module: {
    preloaders: [{
      test: /\.scss/,
      loader: 'import-glob-loader'
    }]
  }
}

Alternatively you can use it as a chained loader

require('style!css!sass!import-glob!foo/bar.scss')

Options

All options are passthrough to node-glob. import-glob comes with two additional options.

  • test = 'import' The test for globbing to be applied. Lines matching test will be expanded. (This is a word-boundary test, so import will match @import but not importScript, for example)
  • delimiter = '\n' The delimiter used to join expanded globs.

Current Tags

  • 1.1.0                                ...           latest (5 years ago)

2 Versions

  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago

Copyright 2014 - 2016 © taobao.org |