main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
666 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var Stylis = require('stylis');
|
---|
| 4 | var onRulePlugin = require('./stylis/plugin-onRule');
|
---|
| 5 |
|
---|
| 6 | exports.addon = function (renderer) {
|
---|
| 7 | if (process.env.NODE_ENV !== 'production') {
|
---|
| 8 | require('./__dev__/warnOnMissingDependencies')('stylis', renderer, ['put']);
|
---|
| 9 | }
|
---|
| 10 |
|
---|
| 11 | renderer.stylis = new Stylis();
|
---|
| 12 |
|
---|
| 13 | var plugin = onRulePlugin(function (rawCssRule) {
|
---|
| 14 | renderer.putRaw(rawCssRule);
|
---|
| 15 | });
|
---|
| 16 |
|
---|
| 17 | renderer.stylis.use(plugin);
|
---|
| 18 |
|
---|
| 19 | var put = renderer.put;
|
---|
| 20 |
|
---|
| 21 | renderer.put = function (selector, css) {
|
---|
| 22 | if (typeof css !== 'string') {
|
---|
| 23 | return put(selector, css);
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | renderer.stylis(selector, css);
|
---|
| 27 | };
|
---|
| 28 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.