Skip to content

thomn/less-plugin-nodemodules-import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

less-plugin-nodemodules-import

This plugin provides less imports from node_modules, just like less/less-plugin-npm-import and webpack's less-loader do.

Usage

Install with npm (or yarn):

$ npm install @thomann/less-plugin-nodemodules-import

Programmatic Usage

Register with your less instance:

const LessPluginNodeModulesImport = require('@thomann/less-plugin-nodemodules-import');
less.render(anyFile, {plugins: [new LessPluginNodeModulesImport(opts)]});

Command-Line Usage

$ lessc --plugin=@thomann/less-plugin-nodemodules-import <less-file>

To define options with command line usage, pass a JSON object string with the parameters as less plugin option:

$ lessc --plugin=@thomann/less-plugin-nodemodules-import={"mainFile":"main.less"}

Note that the parameters have to be valid JSON.

Options

OptionKey Value Type Default Description
importPaths array values from require.module.paths The paths to find imports in
mainFile string index.less Which file to load if the import is a directory
encoding string utf-8 Encoding for reading imported files

Directories in importPaths have to be absolute or relative to the current working directory.

About

Allows importing less files from `node_modules` directory

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published