🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

less-css-helpers

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

less-css-helpers

register helper functions that can be used with LESS, the same way that handlebars helpers are used in templates.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

less-css-helpers NPM version

register helper functions that can be used with LESS, the same way that handlebars helpers are used in templates.

Install

HEADS UP! This currently is not an npm module!!!! I need to come up with a different name, this is a placeholder!!!

Install with npm

$ npm i less-css-helpers --save

Usage

HEADS UP! This currently is not an npm module!!!! I need to come up with a different name, this is a placeholder!!!

var less = require('less');
var register = require('less-css-helpers')(less);

Registering helpers

Register a single helper

Example assets helper, that might be used for dynamically calculating the path to a project's assets directory, relative to the css file's destination.

register.helper('assets', function (path) {
  return 'dist/' + path.value + '/assets/css';
});

Register multiple helpers

register.helpers({
  assets: function (path) {
    return 'dist/' + path.value + '/assets/css';
  },
  foo: function () {},
  bar: function () {}
});

Using helpers

Example of how to use the assets helper we just created above:

@theme: "blah";
@assets: assets("@{theme}");

.image {
  background: url("@{assets}/bar.png");
}

Results in:

.image {
  background: url("dist/blah/assets/css/bar.png");
}

Properties

The following properties are exposed on the this object:

  • options: Any options passed to render are exposed on this object
  • less: the less object

Example

register.helper('assets', function (path) {
  return path.join(path.value, this.options.assets);
});

less: Leaner CSS

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.

This file was generated by verb-cli on May 29, 2015.

FAQs

Package last updated on 29 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts