• Version 3.0.6
  • Published
  • 12.4 kB
  • No dependencies
  • MIT license


npm i @types/less
yarn add @types/less
pnpm add @types/less


TypeScript definitions for less



variable less

var less: LessStatic;


    namespace less

    module 'less' {}

      variable less

      var less: LessStatic;

        namespace Less

        namespace Less {}

          class AbstractFileManager

          class AbstractFileManager {}

            method alwaysMakePathsAbsolute

            alwaysMakePathsAbsolute: () => boolean;
            • Whether the rootpath should be converted to be absolute. The browser ovverides this to return true because urls must be absolute.

            method getPath

            getPath: (filename: string) => string;
            • Given the full path to a file, return the path component.

            method isPathAbsolute

            isPathAbsolute: (path: string) => boolean;
            • Returns whether a path is absolute.

            method join

            join: (basePath: string, laterPath: string) => string;
            • Joins together 2 paths.

            method pathDiff

            pathDiff: (url: string, baseUrl: string) => string;
            • Returns the difference between 2 paths E.g. url = a/ baseUrl = a/b/ returns ../ url = a/b/ baseUrl = a/ returns b/

            method supportsSync

            supportsSync: (
            filename: string,
            currentDirectory: string,
            options: LoadFileOptions,
            environment: Environment
            ) => boolean;
            • Returns whether this file manager supports this file for syncronous file retrieval If true is returned, loadFileSync will then be called with the file.

            method tryAppendLessExtension

            tryAppendLessExtension: (filename: string) => string;
            • Append a .less extension if appropriate. Only called if less thinks one could be added.

            class FileManager

            class FileManager extends AbstractFileManager {}

              method loadFile

              loadFile: (
              filename: string,
              currentDirectory: string,
              options: LoadFileOptions,
              environment: Environment
              ) => Promise<FileLoadResult>;
              • Loads a file asynchronously. Expects a promise that either rejects with an error or fulfills with a FileLoadResult.

              method loadFileSync

              loadFileSync: (
              filename: string,
              currentDirectory: string,
              options: LoadFileOptions,
              environment: Environment
              ) => FileLoadResult | FileLoadError;
              • Loads a file synchronously. Expects an immediate return with wither a FileLoadResult or FileLoadError.

              method supports

              supports: (
              filename: string,
              currentDirectory: string,
              options: LoadFileOptions,
              environment: Environment
              ) => boolean;
              • Returns whether this file manager supports this file for file retrieval If true is returned, loadFile will then be called with the file.

              class PluginManager

              class PluginManager {}


                constructor(less: LessStatic);

                  method addFileManager

                  addFileManager: (fileManager: FileManager) => void;

                    method addPreProcessor

                    addPreProcessor: (preProcessor: PreProcessor, priority?: number) => void;

                      interface Environment

                      interface Environment {}

                        method charsetLookup

                        charsetLookup: (mime: string) => string;
                        • Look up the charset of a mime type

                        method encodeBase64

                        encodeBase64: (str: string) => string;
                        • Converts a string to a base 64 string

                        method getSourceMapGenerator

                        getSourceMapGenerator: () => any;
                        • Gets a source map generator

                        method mimeLookup

                        mimeLookup: (filename: string) => string;
                        • Lookup the mime-type of a filename

                        interface FileLoadError

                        interface FileLoadError {}

                          property error

                          error: unknown;
                          • Error object if an error occurs.

                          interface FileLoadResult

                          interface FileLoadResult {}

                            property contents

                            contents: string;
                            • The contents of the file, as a string.

                            property filename

                            filename: string;
                            • Full resolved path to file.

                            interface ImportManager

                            interface ImportManager {}

                              property contents

                              contents: { [fileName: string]: string };

                                interface LoadFileOptions

                                interface LoadFileOptions {}

                                  property ext

                                  ext?: string | undefined;

                                    property paths

                                    paths?: string[] | undefined;

                                      property prefixes

                                      prefixes?: string[] | undefined;

                                        property rawBuffer

                                        rawBuffer?: any;

                                          property syncImport

                                          syncImport?: boolean | undefined;

                                            interface Options

                                            interface Options {}
                                            • Reference to: * https://github.com/less/less.js/blob/master/bin/lessc * http://lesscss.org/usage/#less-options


                                            property color

                                            color?: boolean | undefined;
                                            • Deprecated

                                              If false, No color in compiling.

                                            property compress

                                            compress?: boolean | undefined;
                                            • Deprecated

                                              If true, compress using less built-in compression.

                                            property depends

                                            depends?: boolean | undefined;

                                              property dumpLineNumbers

                                              dumpLineNumbers?: 'comment' | string | undefined;
                                              • Whether output file information and line numbers in compiled CSS code.

                                              property filename

                                              filename?: string | undefined;
                                              • Filename of the main file to be passed to less.render()

                                              property globalVars

                                              | {
                                              [key: string]: string;
                                              | undefined;
                                              • Defines a variable that can be referenced by the file.

                                              property ieCompat

                                              ieCompat?: boolean | undefined;
                                              • Deprecated

                                                False by default.

                                              property insecure

                                              insecure?: boolean | undefined;
                                              • If true, allow imports from insecure https hosts.

                                              property javascriptEnabled

                                              javascriptEnabled?: boolean | undefined;
                                              • Deprecated

                                                If true, enable evaluation of JavaScript inline in .less files.

                                              property lint

                                              lint?: boolean | undefined;
                                              • True, if run the less parser and just reports errors without any output.

                                              property math

                                              | 'always'
                                              | 'strict'
                                              | 'parens-division'
                                              | 'parens'
                                              | 'strict-legacy'
                                              | number
                                              | undefined;
                                              • Math mode options for avoiding symbol conficts on math expressions.

                                              property maxLineLen

                                              maxLineLen?: number | undefined;

                                                property modifyVars

                                                | {
                                                [key: string]: string;
                                                | undefined;
                                                • Puts Var declaration at the end of base file.

                                                property paths

                                                paths?: string[] | undefined;
                                                • The locations for less looking for files in rules

                                                property plugins

                                                plugins?: Plugin[] | undefined;
                                                • Pre-load global Less.js plugins

                                                property rootpath

                                                rootpath?: string | undefined;
                                                • Add a path to every generated import and url in output css files.

                                                property silent

                                                silent?: boolean | undefined;
                                                • If true, stops any warnings from being shown.

                                                property sourceMap

                                                sourceMap?: SourceMapOption | undefined;

                                                  property strictImports

                                                  strictImports?: boolean | undefined;

                                                    property strictUnits

                                                    strictUnits?: boolean | undefined;
                                                    • Without this option, Less attempts to guess at the output unit when it does maths.

                                                    property syncImport

                                                    syncImport?: boolean | undefined;
                                                    • Read files synchronously in Node.js

                                                    interface Plugin

                                                    interface Plugin {}

                                                      property install

                                                      install: (less: LessStatic, pluginManager: PluginManager) => void;

                                                        property minVersion

                                                        minVersion?: [number, number, number] | undefined;

                                                          interface PreProcessor

                                                          interface PreProcessor {}

                                                            property process

                                                            process: (src: string, extra: PreProcessorExtraInfo) => string;

                                                              interface PreProcessorExtraInfo

                                                              interface PreProcessorExtraInfo {}

                                                                property context

                                                                context: {
                                                                pluginManager: PluginManager;

                                                                  property fileInfo

                                                                  fileInfo: RootFileInfo;

                                                                    property imports

                                                                    imports: {
                                                                    [key: string]: any;

                                                                      interface RefreshOutput

                                                                      interface RefreshOutput {}

                                                                        property endTime

                                                                        endTime: Date;

                                                                          property sheets

                                                                          sheets: number;

                                                                            property startTime

                                                                            startTime: Date;

                                                                              property totalMilliseconds

                                                                              totalMilliseconds: number;

                                                                                interface RenderError

                                                                                interface RenderError {}

                                                                                  property column

                                                                                  column: number;

                                                                                    property extract

                                                                                    extract: string[];

                                                                                      property filename

                                                                                      filename: string;

                                                                                        property index

                                                                                        index: number;

                                                                                          property line

                                                                                          line: number;

                                                                                            property message

                                                                                            message: string;

                                                                                              property type

                                                                                              type: string;

                                                                                                interface RenderOutput

                                                                                                interface RenderOutput {}

                                                                                                  property css

                                                                                                  css: string;

                                                                                                    property imports

                                                                                                    imports: string[];

                                                                                                      property map

                                                                                                      map: string;

                                                                                                        interface RootFileInfo

                                                                                                        interface RootFileInfo {}

                                                                                                          property currentDirectory

                                                                                                          currentDirectory: string;
                                                                                                          • path to the current file, absolute

                                                                                                          property entryPath

                                                                                                          entryPath: string;
                                                                                                          • absolute path to the entry file

                                                                                                          property filename

                                                                                                          filename: string;
                                                                                                          • full resolved filename of current file

                                                                                                          property reference

                                                                                                          reference: boolean;
                                                                                                          • whether the file should not be output and only output parts that are referenced

                                                                                                          property relativeUrls

                                                                                                          relativeUrls: boolean;

                                                                                                            property rewriteUrls

                                                                                                            rewriteUrls?: boolean | undefined;
                                                                                                            • whether to adjust URL's to be relative

                                                                                                            property rootFilename

                                                                                                            rootFilename: string;
                                                                                                            • filename of the base file

                                                                                                            property rootpath

                                                                                                            rootpath: string;
                                                                                                            • path to append to normal URLs for this node

                                                                                                            interface SourceMapOption

                                                                                                            interface SourceMapOption {}

                                                                                                              property outputSourceFiles

                                                                                                              outputSourceFiles?: boolean | undefined;

                                                                                                                property sourceMapBasepath

                                                                                                                sourceMapBasepath?: string | undefined;

                                                                                                                  property sourceMapFileInline

                                                                                                                  sourceMapFileInline?: boolean | undefined;

                                                                                                                    property sourceMapRootpath

                                                                                                                    sourceMapRootpath?: string | undefined;

                                                                                                                      property sourceMapURL

                                                                                                                      sourceMapURL?: string | undefined;

                                                                                                                        interface StaticOptions

                                                                                                                        interface StaticOptions {}

                                                                                                                          property async

                                                                                                                          async: boolean;

                                                                                                                            property fileAsync

                                                                                                                            fileAsync: boolean;

                                                                                                                              property modifyVars

                                                                                                                              modifyVars: { [variable: string]: string };

                                                                                                                                Package Files (1)

                                                                                                                                Dependencies (0)

                                                                                                                                No dependencies.

                                                                                                                                Dev Dependencies (0)

                                                                                                                                No dev dependencies.

                                                                                                                                Peer Dependencies (0)

                                                                                                                                No peer dependencies.


                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/less.

                                                                                                                                • Markdown
                                                                                                                                • HTML
                                                                                                                                  <a href="https://www.jsdocs.io/package/@types/less"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>