Coder Social home page Coder Social logo

rollup-plugin-less's Introduction

rollup-plugin-less

一个 Rollup 插件,用来处理 less 引用,支持将 css 内置进 js,同时支持 ssr,支持 cssModule

Installation

npm install --save-dev @yinxulai/rollup-plugin-less

Usage

import { rollup } from 'rollup'
import less from '@yinxulai/rollup-plugin-less'
// const { rollup } = require('rollup')
// const less = require('@yinxulai/rollup-plugin-less')

rollup({
    input: 'src/index.js',
    plugins: [less(options)],
}).then(/* ... */)

OR

// rollup.config.js
import less from '@yinxulai/rollup-plugin-less'
// const less = require('@yinxulai/rollup-plugin-less')

export default {
  entry: 'entry.js',
  dest: 'bundle.js',
  plugins: [
    less({options}) // will output compiled styles to bundle.css
  ]
}

Configuration

insert boolean

将编译后的 css,namedObject 内嵌入 js 里,使模块的使用者 无需手动 import css 文件,同时对 ssr 支持友好,默认 false

include string[]

include 用来设置仅进行处理的文件

exclude string[]

exclude 用来设置需要忽略处理的文件

cssModule object | bool

本插件使用 postcss-modules 插件来处理 cssModule 同时完整支持 postcss-modules 插件配置,具体请查看 postcss-modules 文档

interface CssModuleOptions {
  scopeBehaviour?: 'global' | 'local'
  globalModulePaths?: (RegExp | string)[]
  generateScopedName?: string | GenerateScopedNameFunction
  hashPrefix?: string
  camelCase?: boolean
  root?: string
}

lessOptions object

本插件使用 less 包来对 less 文件进行预处理,同时完整支持 less 的相关配置 详细信息查看 less 文档

License

MIT

rollup-plugin-less's People

Contributors

yinxulai avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.