simple.js 513 B

12345678910111213141516171819202122
  1. var all = require('./helpers').all;
  2. function store(token, context) {
  3. context.output.push(typeof token == 'string' ? token : token[0]);
  4. }
  5. function stringify(tokens, options, restoreCallback) {
  6. var context = {
  7. keepBreaks: options.keepBreaks,
  8. output: [],
  9. spaceAfterClosingBrace: options.compatibility.properties.spaceAfterClosingBrace,
  10. store: store
  11. };
  12. all(tokens, context, false);
  13. return {
  14. styles: restoreCallback(context.output.join('')).trim()
  15. };
  16. }
  17. module.exports = stringify;