Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/popomore/css2str
transform css to string that can be inserted by js
https://github.com/popomore/css2str
Last synced: about 2 months ago
JSON representation
transform css to string that can be inserted by js
- Host: GitHub
- URL: https://github.com/popomore/css2str
- Owner: popomore
- Created: 2014-06-06T18:42:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-03T10:56:54.000Z (over 10 years ago)
- Last Synced: 2024-10-16T05:21:09.592Z (3 months ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
Awesome Lists containing this project
README
# css2str [![Build Status](https://travis-ci.org/popomore/css2str.png?branch=master)](https://travis-ci.org/popomore/css2str) [![Coverage Status](https://coveralls.io/repos/popomore/css2str/badge.png?branch=master)](https://coveralls.io/r/popomore/css2str?branch=master)
Transform css to string that can be inserted by js
---
## Install
```
$ npm install css2str -g
```## Usage
```
var css2str = require('css2str');
var code = css2str(fs.readFileSync(filepath));
```Then you can use [import-style](https://github.com/popomore/import-style) to import css in browser.
```
var importStyle = require('import-style');
importStyle(code);
```## Options
### prefix
This option will add a parent selector of every selector.
```
// origin cssa {
border: none;
}// yield
.container a{border: none;}
```With code
```
var opt = {prefix: '.container'}
var code = css2str(fs.readFileSync(filepath), opt);
```## LISENCE
Copyright (c) 2014 popomore. Licensed under the MIT license.