npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

connect-css-to-less-fallback

v0.0.1

Published

Connect middleware providing a fallback for missing CSS files to corresponding LESS files

Downloads

5

Readme

connect-css-to-less-fallback

Connect middleware providing a fallback for missing CSS files to corresponding LESS files

PLEASE NOTE: You should use this only during development. For production LESS should be precompiled.

How it works

This middleware checks for each request:

  1. Determines if requested file is a CSS file.
  2. If yes, looks for the requested CSS file.
  3. If not found, looks for a LESS file with the same name.
  4. If found, compiles the LESS file and delivers it, ending the request.

In all other cases, it just calls next() and finishes processing.

Usage

Use NPM to install connect-css-to-less-fallback:

npm install connect-css-to-less-fallback --save

Then load it in your app:

var express = require('express');
var cssToLessFallback = require('connect-css-to-less-fallback');
var app = express();

// just use it with the default options
app.use(cssToLessFallback());

What options are available?

You can provide an options object to the cssToLessFallback function:

app.use(cssToLessFallback({
  // the website root folder (default: '.')
  root: './public',
  // any less plugin you want to use (default: [])
  plugins: [autoPrefix],
  // if set to true true, it embeds sourcemaps (default: false)
  sourceMap: true
}));

Changelog

0.0.1 Initial version


Licensed under the MIT license