Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="container">
  <h1>Live edits<!-- or other events! --> to all Wikimedia wikis </h1>
  <em><a href="https://wikitech.wikimedia.org/wiki/RCStream">Documentation</a></em>
  <span hidden>Messages in the last second: <span id="rate-min">..</span> (average so far: <span id="rate-avg">..</span>/s)</span>
  <div class="alert alert-warning">The stream/v1 API ("RCStream") has been deprecated in favor of stream/v2 ("EventStreams"), also available at <a href="https://wikitech.wikimedia.org/wiki/EventStreams">https://stream.wikimedia.org</a>.</div>
  <div class="alert alert-danger">The stream/v1 API was shutdown in July 2017. See <a href="https://wikitech.wikimedia.org/wiki/EventStreams">https://wikitech.wikimedia.org/wiki/EventStreams</a> for an updated CodePen demo.</div>
  <pre id="feed" class="mw-feed" hidden></pre>
<footer class="mw-footer" role="contentinfo">
	<div class="container">
		<p>Created by <a href="https://github.com/Krinkle">@Krinkle</a>.</p>
.mw-footer {
	padding-top: 40px;
	padding-bottom: 40px;
	margin-top: 100px;
	background: #f9f9f9;
	color: #777;
	text-align: center;
	border-top: 1px solid #e5e5e5
              (function() {
  // See http://socket.io/
  var socket = io.connect('https://stream.wikimedia.org/rc');
  var feedNode = document.getElementById('feed');
  var rateMinNode = document.getElementById('rate-min');
  var rateAvgNode = document.getElementById('rate-avg');
  var errorNode = document.createElement('div');
  errorNode.className = 'alert alert-danger';
  var infoNode = document.createElement('div');
  infoNode.className = 'alert alert-info';
  var updateBuffer = makeDisplayBuffer(10);
  var freq;
    type: 'info',
    message: 'Connecting...'
  socket.on('connect', function() {
      type: 'info',
      message: 'Connected! Listening for events...'
    freq = new Frequency(1000, function (count, average) {
      rateMinNode.textContent = count;
      rateAvgNode.textContent = average;

    // Subscribe to one or more wikis
    // See https://wikitech.wikimedia.org/wiki/RCStream
    socket.emit('subscribe', '*');

  socket.on('change', function(rc) {
    if (freq) { freq.add(1); }

    // See https://www.mediawiki.org/wiki/Manual:RCFeed#Properties
    if (rc.type == 'edit') {
        type: 'rc',
        data: rc


  socket.on('error', function(data) {
     type: 'error',
     data: data || /* Hardcoded as of 2017-07-10 */ '[error] Server unavailable'

  function printEvent(event) {
    var node;
    if (event.type === 'rc') {
      var node = document.createTextNode(JSON.stringify(event.data) + '\n\n');
    } else if (event.type === 'error') {
      if (!errorNode.parentNode) {
    } else if (event.type === 'info') {
      if (!infoNode.parentNode) {

  function makeDisplayBuffer(size) {
    var buffer = [];
    return function (element) {
      if (buffer.length > size) {
        var popped = buffer.shift();

function Frequency(interval, callback) {
  var freq = this;
  var rAF = window.requestAnimationFrame || setTimeout;

  this.interval = interval;
  this.callback = callback;
  this.count = 0;
  this.total = 0;
  this.since = this.start = this.now();
  function checker() {
Frequency.prototype.now = ( function () {
  var perf = window.performance;
  return perf.now ?
    function () { return perf.now(); } :
    function () { return +new Date(); };
}() );
Frequency.prototype.add = function (count) {
  this.count += count;
  this.total += count;
Frequency.prototype.check = function () {
  var count, avg, ellapsedTotal;
  var ellapsed = this.now() - this.since;
  if (ellapsed >= this.interval) {
    ellapsedTotal = this.now() - this.start;
    count = this.count;
    // One optional digit
    avg = (this.total / (ellapsedTotal / this.interval)).toFixed(1).replace('.0', '');
    this.since = this.now();
    this.count = 0;
    this.callback(count, avg);
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.