list-content-styles.js 654 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env node
  2. /**
  3. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  4. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  5. */
  6. /* eslint-env node */
  7. const postcss = require( 'postcss' );
  8. module.exports = postcss.plugin( 'list-content-styles', function( options ) {
  9. const contentRules = options.contentRules || [];
  10. return root => {
  11. root.walkRules( rule => {
  12. rule.selectors.forEach( selector => {
  13. if ( selector.match( '.ck-content' ) ) {
  14. contentRules.push( {
  15. file: root.source.input.file,
  16. css: rule.toString()
  17. } );
  18. }
  19. } );
  20. } );
  21. };
  22. } );