Git Product home page Git Product logo

less-plugin-glob's Introduction

less-plugin-glob

Globbing support in Less-imports.

Travis status npm version David

This plugin allows to import multiple files using glob expressions. Add this plugin and you can write import like this

@import "common/**";
@import "themes/**";

How to add plugins?

Section about plugins in Less documentation

Examples

lessc usage

  1. npm install -g less less-plugin-glob
  2. Create file with import by glob, something like @import "includes/**"
  3. Run lessc --glob styles.less styles.css and enjoy whole your styles concated by one line

Programmatic usage

  1. Install plugin locally npm install less-plugin-glob
  2. Import it and add into plugins section of options.
less.render(lessString, { plugins: [require('less-plugin-glob')] })

If you are using Gulp or Grunt or something else, you can import and add plugin by same way as well.

Usage with webpack and less-loader

When using webpack and less-loader >= 4.0, it's important to make sure that less-loader is configured not to use its webpack resolver, which is now active by default. Otherwise, less-plugin-glob won't run at all because less-loader applies a LESS plugin that passes all queries to the webpack resolver (bypassing this plugin). To make less-loader revert to the LESS resolver, specify the paths loader option:

{
  loader: "less-loader",
  options: {
    plugins: [lessPluginGlob],
    paths: [path.resolve(__dirname, "path/to/my/styles")] // This is the important part!
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.