https://github.com/featurist/hobostyle
Dynamic CSS for your web page!!!
https://github.com/featurist/hobostyle
Last synced: about 2 months ago
JSON representation
Dynamic CSS for your web page!!!
- Host: GitHub
- URL: https://github.com/featurist/hobostyle
- Owner: featurist
- Created: 2013-10-09T07:28:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-12T11:09:17.000Z (over 9 years ago)
- Last Synced: 2025-02-20T12:15:32.385Z (2 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hobo Style
Dynamic CSS for your web page!!!
# How to use?
Assuming you're using [browserify](https://github.com/substack/node-browserify):
```bash
npm install hobostyle
```Then
```js
var hobostyle = require('hobostyle');
``````js
var mystyle = hobostyle.style('body { background-color: blue; }');
```Then later,
```js
mystyle.set('body { background-color: red; }');
```# API
## Style
```js
var mystyle = hobostyle.style(css);
```This will create a new `` element in your `<head>` containing `css`.
```js
mystyle.set(newCss);
```This will replace the original css with `newCss`, in the same `<style>` element.
```js
mystyle.remove();
```Will remove the style element.
## Link
```js
var mystyle = hobostyle.link(cssUrl);
```This will create a new `<link type="stylesheet" href="...">` element in your `<head>` linking to `cssUrl`.
```js
mystyle.set(newCssUrl);
```This will set the href to `newCssUrl`.
```js
mystyle.remove();
```Will remove the style element.