1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 1× 14× 14× 14× 14× 5× 4× 13× 12× 12× 6× 2× | // This simple backend pushes the arguments in arrays in a buffer and return it as is. // So, for example, // j2c.sheet({'@global': { // '@keyframes foo': { // 'from, to': {width: 0} // }, // '.bar' :{ // animation: 'baz 1sec', // } // }}) // // becomes // // [ // ['atrule', '@keyframes', 'keyframes', 'foo', 'rule'], // ['rule', 'from, to'], // ['decl', 'width', 0], // ['_rule'], // ['_atrule'], // ['rule', '.bar'], // ['decl', 'animation', 'baz 1sec'], // ['_rule'] // ] module.exports.simple = {sink: function() { var buffer return [{ init: function() { buffer = [] }, done: function() { return buffer }, atrule : function(rule, kind, params, hasblock) { buffer.push(['atrule', rule, kind, params, hasblock]) }, _atrule : function() { buffer.push(['_atrule']) }, decl: function(prop, value) { buffer.push(['decl', prop, value]) }, rule : function(selector) { buffer.push(['rule', selector]) }, _rule : function() { buffer.push(['_rule']) }, err: function(message) { buffer.push(['err', message]) }, raw: function(str) { buffer.push(['raw', str]) }, buffer: buffer }] }} |