Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

css2str

popomore216MIT0.1.1

transform css to string that can be inserted by js

readme

css2str Build Status Coverage Status

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 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 css

a {
  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.

changelog

History


0.1.1

fix comment after selector

0.1.0

First Version