JSPM

simple-less-middleware

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q48067F
  • License MIT

a simple LESS middleware for server requests

Package Exports

  • simple-less-middleware

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-less-middleware) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

simple-less-middleware

unstable

A minimal LESS middleware for server requests.

Install

npm install simple-less-middleware --save

Example

var lessMiddleware = require('simple-less-middleware')

// path to the LESS entry point
var file = '/path/to/style.less'

// what the <link href> will request
var url = 'style.css'

var less = lessMiddleware(file, url, {
  compress: true,
  autoprefix: 'last 2 browsers'
})

var server = http.createServer(function (req, res) {
  less(file, cssUrl, function () {
    // handle non-less requests...
  })
})

server.listen(8000)

Usage

NPM

fn = middleware (lessFile, cssUrl, [opts])

Creates a new fn(req, res, next) function with lessFile (path to LESS entry point) and cssUrl (the URL pathname to respond to the request on).

Options:

  • compress Boolean, default false
  • autoprefix Array or comma-separated String list of browsers, default no autoprefixing
  • paths Array of paths to provide to LESS render()

License

MIT, see LICENSE.md for details.