JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 134
  • Score
    100M100P100Q75548F
  • License BSD-2-Clause

Dynamic CSS for your web page!!!

Package Exports

  • hobostyle

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 (hobostyle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Hobo Style

Dynamic CSS for your web page!!!

How to use?

Assuming you're using browserify:

npm install hobostyle

Then

var hobostyle = require('hobostyle');
var mystyle = hobostyle.style('body { background-color: blue; }');

Then later,

mystyle.set('body { background-color: red; }');

API

Style

var mystyle = hobostyle.style(css);

This will create a new <style> element in your <head> containing css.

mystyle.set(newCss);

This will replace the original css with newCss, in the same <style> element.

mystyle.remove();

Will remove the style element.

var mystyle = hobostyle.link(cssUrl);

This will create a new <link type="stylesheet" href="..."> element in your <head> linking to cssUrl.

mystyle.set(newCssUrl);

This will set the href to newCssUrl.

mystyle.remove();

Will remove the style element.