Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including rollup-plugin-less-loader with all npm packages installed. Try it out:

var rollupPluginLessLoader = require("rollup-plugin-less-loader")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

rollup-plugin-less-loader v0.2.1

a rollup plugin for less files

说明

解决原版在多入口打包CSS的情况下的BUG

Install

npm install rollup-plugin-less-loader --save

usage

import './test.less';
//generate css will be auto insert to the head tag if you set insert be true
import { rollup } from 'rollup';
import less from 'rollup-plugin-less-loader';

rollup({
    entry: 'main.js',
    plugins: [
        less()
    ]
});

Options

insert

  • Default: false
  • Type: Boolean

If you specify true, the plugin will insert compiled CSS into <head/> tag.

output

  • Default: rollup.build.css

  • Type: String|Function

If you specify a string, it will be the path to write the generated CSS. If you specify a function, call it passing the generated CSS as an argument.

include

  • Default: [ '**/*.less', '**/*.css' ]

  • Type: String|Array

Minimatch pattern or array of minimatch patterns to determine which files are transpiled by the plugin.

exclude

  • Default: node_modules/**

  • Type: String|Array

Minimatch pattern or array of minimatch patterns to determine which files are explicitly not transpiled by the plugin, overrules the include option.

option

  • Type: Object

Options for less.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free